Many of us are aware of LINQ today. LINQ is an amazing programming language feature. During my discussions I find a lot of myths around understanding. Here I have tried to demonstrate from some basics of C# 3.0 language enhancements to delegate, anonymous type, lambda expression and finally LINQ. How it has evolved.
We develop our ADO.NET EF model from the development environment db and then when finally run it to the production we might find that DBA might have added few rules or renamed the database columns. Then our application would start throwing errors. One easy way to get it rectified is to run query against each entity and catch if any error. Otherwise EF gives some public API to use.
I have created my edmx from my dev database and it has just two columns.
Now at production let’s suppose my column is EmpNameTest. How can I programmatically check the difference?
I was going through the tool EdmGen.exe and it gives us an option to validate via
EdmmGen /mode:ValidateArtifacts /inssdl:Model1.ssdl /inmsl:Model1.msl /incsdl:Model1.csdl
All the three files can comes from your edmx file. If you choose the option from edmx file to be part of your output directory, then it will same all of then individually to your output directory.
Now, I will generate the ssdl at runtime by reading the production database, this gets saved to my output directory.
Now call it from your method,
Then run the validate method as below,
I found this solution from the EdmGen2.exe. You will find the whole source code available at http://code.msdn.microsoft.com/EdmGen2
Two points before you try it out,
Recently I have posted one Channel 9 video on How to Develop Database using Visual Studio 2010. From keeping it within Source Control to Refactoring. It’s just a fun.
I have recently added one video in Channel 9 at http://channel9.msdn.com/Blogs/wriju/Team-Foundation-Server-2010--Creating-Team-Project
I love the new look of Channel 9.
More on Developer Details at http://msdn.microsoft.com/en-us/ie/ff468705.aspx
After it installs the IE9 the machine will be restarted and you will get a super cool browser.
IE 9 Rocks!!!
Internet Explorer 9 or IE9 is simply magic and launched today (Sept 15, 2010). Download it from here at http://windows.microsoft.com/en-US/internet-explorer/download/ie-9/worldwide
Lots of canned demos are at http://ie.microsoft.com/testdrive/. I personally liked the HTML 5 power http://ie.microsoft.com/testdrive/
Most of the time we struggle to get some dummy data for various types of testing. Data Generation Plan in Visual Studio 2010 helps to achieve it. It not only fills the tables based on the number of rows selected by us it also takes care of the relationship if any. One thing to remember is about the quality of data, all junk.
Let’s suppose you have a database project of Northwind. Now you need to create some 5000 categories to do a Load Testing. Very easy to achieve,
Database Project > Add New Item > Data Generation Plan. Then choose the number of Rows.
Once done you can choose to run by hitting F5 or use menu,
Your dummy data is ready, please do not try to ready it :).
To answer the common questions related to MSDN is available here http://www.microsoft.com/downloads/details.aspx?FamilyID=2b1504e6-0bf1-46da-be0e-85cc792c6b9d&displaylang=en
When you have two SQL Sever Databases and need to find the differences, Visual Studio comes really handy.
Under Visual Studio 2010’s menu Data > Schema Compare. Once you choose New Schema Comparison
Then you choose your databases. After you choose it you can also set the Schema Compare Settings. Once you press OK. It gives you the report.
Let’s suppose you have one additional column in your database, it shows something,
You can further drill-down to find the details,
Now this also gives you the Script differences with highlight.
Then you can choose Write Update from menu
This will update you right selection (Target).