June 2013 - Digital Tool Factory blog June 2013 - Digital Tool Factory blog

The Digital Tool Factory Blog

When the jquery $.post doesn’t work the way you expect it to…

The Problem

In my was posting a contact form to an outside service, and then redirecting to a page on the same site.  I thought, Aha, I will use the handy jquery .post command – it looked something like this.

$.post(“https://www.outsidesite.com/FormSubmit.php”, $(“#myform”).serialize());
window.location.href=’http://www.MySite.com/SomePage/’;

But curiously, half of the time I filled out the form the data did not reach the outside server, and the other half the redirect did not happen.

The Cause

$.post is an asynchronous operation by definition – and cannot be made synchronous.

The Solution

Just use the regular jquery .ajax function, and set async to false

$.ajax({type: ‘POST’, url: “https://www.outsidesite.com/FormSubmit.php”, data: $(“#myform”).serialize(),async:false});
window.location.href=’http://www.MySite.com/SomePage/’;

That’s it, now the browser waits until the submission is complete and everything works as expected.

 


27
Jun 13


Written By Steve French

 

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

 




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