>>>Hi, Naomi, just a curious question - why is LINQ to SQL being used?
>>>
>>>(I don't mean that question the way it sounds - I'm always genuinely curious when someone uses LINQ to SQL)
>>>
>>>Thanks....
>>
>>We're using Entity Framework in this application. The database is SQL Server.
>
>I understand. But "why"? These types of things have been done many times over in SQL Server/T-SQL (and I know you know that) :)
http://blogs.msdn.com/b/gblock/archive/2006/10/26/ten-advantages-of-an-orm.aspxAnd to add a few more reasons:
- Compile time checking of types/queries.
- Being able to apply multiple optional filters without a complicated where clause or modifying the SQL code.
- Being able to apply an interface to multiple entities and write extension methods against that interface. For example several tables could have an active flag. You can put an IActiveEntity interface on the models for those tables and write a method such as ActiveOnly that retrieves only the active records. That same method can then be used for any set that implements that interface.