If you're anxious to get to the point of this, just skip to the last paragraph.
I'm totally new to MVC2 and I've been tasked with creating a database management application with it. After spending a few weeks getting the hang of it, I've finally begun writing my production code. In order to test my code out, I need to be able to access the copy of the database on a dev server. When it's time to put a release version up, it obviously needs to work with the live database.
Initially, I created two side-by-side models (using the entity framework) of the maintenance database and just changed the namespace of the other one to something like DevModels and opposed to just Models in order to avoid name clashes (they're the exact same model, just different sources). This caused more problems than it solved. Anyway, while pouring through the book Pro ASP.NET MVC 2 Framework, I got the bright idea to just change the datasource in the Web.Config file. This way, when I publish the app, it will automatically have the correct datasource. Long story short, this didn't exactly work and caused more problems than it solved.
Anyway, I've done some looking around but I just can't find anything. All the material I find is rather unspecific and leaves me more confused. I'm sure there's a simple way to do this as it HAS to be a common thing.
So, in summary, how do I write an MVC2 application once and be able to use the model with different datasources so I don't have to heavily modify code to make a production version of my application?
UPDATE: Here's the connection string before and after I change it. Before=dev server
`metadata=res:///Models.MaintModel.csdl|res:///Models.MaintModel.ssdl|res://*/Models.MaintModel.msl;provider=System.Data.SqlClient;provider connection string='Data Source=EXP_POWERSUITE2;Initial Catalog="Maint DatabaseSQL";Integrated Security=True;MultipleActiveResultSets=True'"
`metadata=res:///Models.MaintModel.csdl|res:///Models.MaintModel.ssdl|res://*/Models.MaintModel.msl;provider=System.Data.SqlClient;provider connection string='Data Source=EXP_POWERSUITE;Initial Catalog="Maint DatabaseSQL";Integrated Security=True;MultipleActiveResultSets=True'"
Also, in order to make sure I had the right connection string, I started a new app and made a new edm with the same names and everything but geared towards to live database. I was looking for any obvious differences but it was the exact same thing as what I have above.
Also, I can retrieve and display rows from the database in my application. I just can't add them.
I'm using MS SQL Server Manager 2008 R2.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)