I used to prefer using SqlMetal to the OR Designer in Visual Studio when generating my Linq2SQL model.
So, my question is: Is there an equivalent to SqlMetal for generating EF4 models, i.e. a command-line tool for rebuilding my EF classes in one step?
EF has a tool called EDM Generator.
Related
My question is this. When trying to decide between using the Entity Framework and LINQ to SQL as an ORM, I am trying to figure out whether to use MSSQL or MYSQL....which one is preferred?
I heard that LINQ to SQL is tied to SQL Server is that still true?
NET integration story (C#, Linq, Entity Framework, etc.) in SQL Server is better is what I heard,please share your opinions
LINQ to SQL was introduced as part of .net 3.5 from memory. I don't see why you'd use it over EntityFramework now however, EF has come a long way and provides as far as I'm aware all the features LINQ to SQL did:
https://github.com/aspnet/EntityFramework6
EF and Linq to Sql are both Microsoft products, and SQL Server is a Microsoft product. Mysql is not a Microsoft product. In my experience, things work better if you stick with the same vendor. If you go with EF or Linq to SQL, and you have no other reasons to choose one over the other, my guess is you'll be happier if you pair it with SQL Server.
i have an existing database on local sql server 2008.
what should i do to access the database and to display the contents of that database.
i am using visual studio 2010 and i have to make a mvc3 web application for which i have to access the database.
should i have to make model classes(entity classes) or rather can these be generated from my database. please help me with this problem.
This is a very open question and any answer will depend a lot on personal preference. I would suggest that if you are using MVC3 and VS2010 you look at Entity Framaework, Microsofts ORM (Object relational mapper).
EF MVC Tutorial
You can produce a Model from the Database or Write a Domain model that mirrors the DB using Code First its up to you the tutorial linked explains how.
Alternatives would include Nhibernate, Subsonic and a bunch of other ORMs or just doing it all your self with ado connections and commands.
I'm currently using VB.NET Express to connect to mySQL over the net. No problem as long as I use plain vanilla SQL connections and statements.
But when it comes to LINQ 2 mySql, I'm struck by VB Express's limitation.
Any clue you gurus?
You'll need to switch out to using something like DBLinq, Entity Framework, or nHibernate instead of Linq-to-SQL. Linq-to-SQL only supports SQL Server and SQL Server CE. This isn't a
limitation of Visual Studio Express at all. Actually, the only limitations I know of with the express editions are that they don't support any Visual Studio plug-ins - but as far as CLR features, you aren't limited at all using Express. And, Entity Framework is built-in and available for you to use out of the box. And stackoverflow has info on the MySQL connector.
After a couple of days searching, Iv' finally reached the Saint Graal!
Since you guys at StackOverflow are so great a bunch of blokes, I've written a little how to sample for you. Here it is:
1 - The ONLY sensible, free and working product I've founr is Devart LinqConnect Express edition.
Its a free product from www.devart.com, capable of:
(Please note I have no particular links nor interest with them.)
Generating datacontext from its own embarked Devart EntityDeveloper free edition
(With some limits in number of tables per context, 10 if I'm right).
Complete the LINQ dlls into Visual Basic Express edition, without having to create a datasource from the datasource explorer.
Ok, once you've installed the package, here's the how to:
Launch the Entity designer from Program Files\Devart LinqConnect and create the model from the database.
Save the model and launch your VB Winform project.
Add the following .NET references:
Devart.Data.Linq
Devart.Data.MySql.Linq '-- Or any other DB you need
System.Data.Linq
Now add the new datacontext.designer.vb file you've created in Entity Developer
to the project:
Right-click the project in Solution Explorer and select
Add existing item
Locate the datacontext file and that's almost it!
Create a button and a datagridview named dgv1 onto your form.
5 more lines of code and you're set!
Button code:
Dim ctx As New myDataContext.myDataContext
Using ctx
Dim tbl = From xxx In ctx.myTable
Select xxx
dgv1.DataSource = xxx.ToList
End Using
The rest is pure cosmetic LOL...
It is worth to mention that although their product is great, the support is great as well!
They answered my questions in less than 12 hours.
Current ASP.Net MVC 2 uses Linq to SQL or Linq to entites? i am using VS 2008.
ASP.NET MVC 2 can also be used with normal ADO.NET. What you use for your data access has nothing to do with what technology you use on the UI side of your architecture.
What probably confuses you a bit at this moment is that you see mostly examples written with Linq to Sql or Entity Framework. However these could also be written with other technologies like Subsonic or NHibernate.
Read this article: Extending NerdDinner: Exploring Different Database Options. It shows the following technologies:
ADO.NET Connected (DataReaders)
ADO.NET Disconnected (DataSets)
LINQ to SQL
LINQ to Entities (Entity Framework)
I've got a vertical market Dot Net Framework 1.1 C#/WinForms/SQL Server 2000 application. Currently it uses ADO.Net and Microsoft's SQLHelper for CRUD operations.
I've successfully converted it to Dot Net Framework 4 C#/WinForms/ SQL Server 2008. What I'd like to do is also offer my customers the OPTION to use SQL Azure as a backend storage for their data instead of local/LAN SQL Server.
If I know SQL Azure is in my application's future, should I:
A. Switch to LINQ to SQL
or
B. Swith to Entity Framework
or
C. Stick with ADO.Net and SQLHelper
?
Thanks !
I would switch to Entity Framework, it works just fine with SQLAzure and is the recommended ORM by Microsoft for .Net 4
ADO.net works just fine,
My personal favorite is Linq2Sql which works fine with azure
Microsoft is now recommending that everyone switch to entity framework