Posts

Showing posts from March, 2012

The model backing the 'MyDBContext' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the DropCreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, and optionally seed it with new data.

Today I have faced a problem when working with a previous developed ASP.NET MVC application. Just copy the database(.sdf) from previous version to new version. I have changed some validation and business logic. But when run the application it shows me the following error:


The model backing the 'MyDBContext' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the DropCreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, and optionally seed it with new data.

It was a running application after searching on community I have got the solution.

Solution 1:
However, even if you manually update the database to follow the model, this exception will still occur. The reason is that EF does not check model schema completely: tables, columns, keys, indexes etc.

It calculates a hash of the model and compares with the hash of model…

ASP.NET Single Page Application (SPA)

Image
My previous article wrote about new features of MVC 4.0 beta. Today I want to share with you another cool feature "ASP.NET Single Page Application (SPA)" known as ASP.NET SPA.
The ASP.NET Single Page Application (SPA) is a new feature in MVC 4 beta preview.

This project type is based on a stack of open source libraries and the MVVM pattern made popular by WPF and Silverlight. Single Page Application(SPA) Frameworks are growing popularity in the web community with lot of libraries such as JavaScriptMVC, Backbonejs and many other libraries.

(Img src: asp.net official site)

ASP.NET MVC 4 introduces experimental support for building single page application (SPA) through a template. Much of the plumbing work of wiring up the client side scripts, javascript modelviews and the controllers is automated, making it a quick start to develop SPAs relatively easier.

The ASP.NET Single Page Application (SPA)includes the following components:

1.A set of JavaScript libraries for riche…

New cool features in MVC 4.0

Image
Last few days I have worked on MVC3 and MVC4 beta. In MVC4 beta some cool features added like:

1.ASP.NET Web API
2.ASP.NET Single Page Application
3.Enhancements to Default Project Templates
4.Mobile Project Template


5.Display Modes

Error: Unable to Validate Data

Recently I have made some changes on my application after upload I have found this error:

Unable to validate data at
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier,
Int32 start, Int32 length, Int32& dataLength) at
System.Web.UI.LosFormatter.Deserialize(String input)

But I don't understand why this error was happening. Because I have changed on business logic not any architecture. After doing some r&d got the answer:)


Potential causes:

1.An application pool recycling between the time the viewstate was generated and the time that the user posts it back to the server (unlikely).
2.Modification of viewstate by firewalls/anti-virus software
3.A web farm where the machineKeys are not synchronized (not your issue).
4.Posting from one aspx page to another.

After studying various tutorial I have found that the problem is with the viewstate. The viewstate is actually decrypted in the server using a secret Machine key which resides on the server. Th…

Orchard 1.4 Is released!!

Last day officially announced that the new Orchard release - version 1.4. It's a big step forward from the previous, 1.3.10 version, both in terms of performance and features.

Orchard 1.4 is here! The release is published on our Orchard CodePlex website and Microsoft Web Application Gallery.


What's new?

Orchard 1.4.0 fixes bugs, improves performance and introduces the following features:

Autoroute: Set-up token-based patterns for your URLs. David Hayden has a good post describing the feature: http://www.davidhayden.me/blog/autoroute-custom-patterns-and-route-regeneration-in-orchard-1.4

Projector: Create arbitrary queries on your site contents, then display the results in projection pages and widgets.

Fields: Orchard now comes with new field types for Boolean, Date/Time, Enumeration, HTML5 Input, Links, Media Picker and Numeric. The text field has a new setting for the flavor which adds html, markdown and textarea to the default text box.


Breaking Changes

Orchard 1.4 introduces a br…