Digital Tool Factory blog - Page 7 of 34 - Backend web development in Atlanta GA Digital Tool Factory blog - Page 7 of 34 - Backend web development in Atlanta GA

The Digital Tool Factory Blog

How to fix the “error 2025: XML Schema validation failed for mapping schema.” error

The Problem

You’ve been upgrading and downgrading Entity Framework, and just when everything seems to be working, you get an error of

Schema specified is not valid. Errors:
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared..
<File Unknown>(0,0) : error 2025: XML Schema validation failed for mapping schema. Schema Error Information : The ‘http://schemas.microsoft.com/ado/2012/10/edm/migrations:IsSystem’ attribute is not declared.

The Cause

The data migrations have gotten out of sync

The Solution

The solution (use at your own risk)

  1. Delete the migrations folder and
  2. Drop the _MigrationHistory table in the database
  3. Run Enable-migrations -Force in the package manager console
  4. Add a migration
  5. Check the migration file that is created – it should have a listing of your entire database – delete the table creation and dropping code
  6. run update-database -verbose

You should be back in business!


04
Jun 13


Written By Steve French

 

How to fix the “Could not determine storage version; a valid storage connection or a version hint is required”

The Cause:

You’re cruising right along updating everything properly when all of a sudden you get an inexplicable

Could not determine storage version; a valid storage connection or a version hint is required

error

The Cause:

You’ve been upgrading and downgrading Entity Framework Versions.  The actual error has nothing to do with the error message listed above.

The Solution:

There really is no good solution to this, as I have spent the past six hours proving – the best thing to do is just to upgrade to Entity Framework 6 and find some other workaround for any other problem.


03
Jun 13


Written By Steve French

 

Updating for the sole purpose of the Google Author Plugin

I apologize to my regular readers for this empty post.  I need to update to get the Google Author plugin to be recognized by Google


11
Apr 13


Written By Steve French

 

How to explain caching to clients

'Translator' photo (c) 2010, Mace Ojala - license: http://creativecommons.org/licenses/by-sa/2.0/I recently implemented a quick performance fix on a client’s site recently by implementing caching.  I explain caching with the following metaphor.

Imagine that your site is a book.  A book written in a weird mix of Latin, Sanskrit and Old Norse.    It’s precise,  complicated and requires translation into English by an expert translator before it can be read by the public.

Your web server translates the book.  Anytime, someone tries to read the book they cannot read it directly; they need someone (the web server) to translate the book.  This can take a lot of time and energy for the translator to do, but it has to be done.

 

A simple version of the process

To clarify, the process works like this

  1. Person makes a request, i.e. “what does that book say? [Non Resource Intensive Step]
  2. The translator looks at the book, and makes a careful translation into modern day English of the book from the original Latin, Sanskrit, and Old Norse.    This can take a long time [Resource Intensive Step].
  3. After the translator completes the translation he sends it on it’s way to the person who made the request [Non Resource Intensive Step].
  4. The person who makes the request receives the translation and the interaction is complete [Non Resource Intensive Step].

That all sounds good, but the problem is that the four step process has to happen each and every time anyone makes a request, especially the resource intensive step two.  So, if a web page gets 1000 requests an hour, resource intensive step #2 runs 1000 times.

 

The first request with caching

Now imagine if the translator makes a copy of the English translation after he sends it out the first time.  The first time someone makes a request for a translation the process looks like this.

  1. Person makes a request, i.e. “what does that book say? [Non Resource Intensive Step]
  2. The translator checks to see if there are any photocopies of the translation that are less than an hour old [Non Resource Intensive Step]
  3. The translator looks at the book, and makes a careful translation into modern day English of the book from the original Latin, Sanskrit, and Old Norse.    This can take a long time. [Resource Intensive Step]
  4. After the translator completes the translation he makes photocopies of the translation. [Non Resource Intensive Step]
  5. Then the translator sends the photocopy of the translation on it’s way to the person who made the request. [Non Resource Intensive Step]
  6. The person who makes the request receives the translation and the interaction is complete. [Non Resource Intensive Step]

Subsequent requests with caching

Subsequent requests for the book look like this

  1. Person makes a request, i.e. “what does that book say? [Non Resource Intensive Step]
  2. The translator sends the photocopy of the translation on it’s way to the person who made the request. [Non Resource Intensive Step]
  3. The person who makes the request receives the translation and the interaction is complete. [Non Resource Intensive Step]

The first time someone makes a request the process runs a little slower, but since each subsequent request for the book omits all of the resource intensive steps, the whole process take up much less time and fewer resources, making for a much lower delivery time on average, e.g. for every 1000 requests for a page, resource intensive step #2 runs 1 time, not 999 times.

Making a photocopy is pretty close to caching.  The web server makes a copy of the page it just created and sends it on it’s way to web browsers.

 

What are the downsides of caching?

What are the downsides of caching, and why doesn’t everyone use it?   I’ve seen two main reasons not to use caching.

  1. The contents of the book can change unexpectedly.  If it does, then the translator is handing out old editions of the book.  That might be fine for some sites, but for others it might be catastrophic   For example, if a blog serves up a slightly out of date version of a post no one will care that much, but if a stock market application serves up old stock prices people will care a lot.  With caching, the translation/web page can be up to an hour old.
  2. It makes debugging much harder if everyone sees slightly different versions of the same thing.

That’s how I explain caching to clients.  I’ve always had people find the metaphor clear and easy to understand.


18
Mar 13


Written By Steve French

 

How to install wordpress in a subdirectory of a site with an existing .htaccess file

This happened to me whilst working on a  pre-existing site recently.

 

The Problem

You are trying to install WordPress onto a subdirectory of an existing site that uses the .htaccess files for routing.  When you try to add in the changes needed for WordPress to work you break the existing site.

The Cause

WordPress .htaccess files do not play nicely with other .htaccess files

The Solution

Simply add in the WordPress generated .htaccess files in the WordPress directory, and everything magically works.

For Unix people this must be obvious, but for me it was surprisingly brilliant.

 


13
Mar 13


Written By Steve French

 

The case of the disappearing WordPress widgets

A silly one this time

The Problem

I was recently working on someone else’s WordPress theme that made extensive use of WordPress Widgets and the new dynamic sidebar feature.  I was able to recreate the widgets (there was a working staging site) but the on the production site the widgets did not appear.  What to do about disappearing WordPress widgets?

The Cause

I had changed the name of the theme.  For some reason the register_sidebar has to have the name hard coded, for example

register_sidebar( array(
		'name' => __( 'Banner Area', 'themename' ),
		'id' => 'Banner-area',
		'description' => __( 'Banner area', 'themename' ),
		'before_widget' => ' <div>',
		'after_widget' => '</div>',
		'before_title' => '<div><h1>',
		'after_title' => '</h1></div>',
	) );

The Solution

Just change the name of the theme to the new name and you’re all set!


12
Mar 13


Written By Steve French

 

A simple tip on the Bing Keywords API

Just a quick reminder for anyone who uses the Bing Keywords API.

As you become aware as you do more and more things with the API, the code itself it beautiful, but the access to it is difficult.  I recently (a month or two ago actually)  on tech support finding out that the developer token (given to you in the introductory email) is the same as the access key (which they reference numerous times in the training material.  They are one and the same.


11
Mar 13


Written By Steve French

 

My quick review of Red Gate’s Cloud Storage Studio 2

I recently had reason to move  a large number of files from one windows storage account to another.  One would think that this would somehow be built into Windows Azure storage, but alas, it is not that way.

Anyway, I searched the internets and came across Red Gate’s Cloud Storage Studio 2, which is more or less a file manager for Windows Azure Storage.

Here are my initial thoughts on Cloud Storage Studio 2

  1.  Overall status messages and notification messages appear in different places, this is  a bit annoying and confusing.
  2. I’m able to use it the way I want to without reading any documentation – that is always nice.
  3. The notifications and status need to be a bit more apparent – with a high latency product like a remote file manager the action status should be a bit more prominent.
  4. The price is a bit high – at $199 it’s a bit high for an impulse buy, and as a small shop I have a once a month need for a product like this (at present).  It is something I would have to consider.

On the whole, I like it, it works well (as I expect from Red Gate) and I would recommend it to others.

 


18
Feb 13


Written By Steve French

 

Just added two interviews to the main site

Here are my interviews with Business Radio X.  Enjoy!


23
Jan 13


Written By Steve French

 

How to fix the infamous “Unable to cast object of type ‘System.Int32’ to type ‘System.String’ error in asp.net mvc

The Problem

You have created a lovely model in asp.net mvc 4, using Entity Framework and a whole host of attributes.  One of the properties of your model looks like this

[Required]
[Display(Name = “Expiration Month (MM)”)]
[StringLength(2,ErrorMessage = “You must enter two digits”, MinimumLength = 1)]
[Range(1,12, ErrorMessage = “You must enter a valid month”)]
public int ExpirationMonth { get; set; }

That yields an error of

Unable to cast object of type ‘System.Int32’ to type ‘System.String

When the form is submitted, but not when the object is created (which is a bit odd)

The Cause

It turns out that you cannot use the StringLength data attribute on an int data type.  You would think you could since all you are actually interested in with that data attribute is the number of digits, but the data gods have decreed that you can’t.

The Solution

Just comment out StringLength and use the Range Attribute.


17
Jan 13


Written By Steve French

 




Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.