entity-framework

Error: Failed to generate a user instance of SQL Server

I'm trying to connect to an MDF. I've even gone to the lengths of re-installing sql server express entirely (it is now the only flavor of SQL installed on my box, where previously I had 05 dev and express). I've verified that the paths are all correct, and thus far my google-fu hasn't helped. The Full exception message is: Failed to g...

Entity framework: One big model or a set of smaller models?

We been having some discussions on approaches to using the entity framework at work recently. We have a fairly large and complex n-tier web based application, which is due for a major overhaul. The question is: If we where to starting using the entity framework, would it be better to create one big model, or a set of smaller functional/...

Building DB schema from Entity Framework Model

I see that EF can update a model based on an existing database schema. However, I'm starting totally from scratch; I don't want to build tables, then rebuild them in the EF model file. Is there a way that I can draw out a model file, and have the SQL tables automatically be created for me? ...

How do I use Read-Only properties defined in partial (Entity Framework) classes over ADO.Net Data Services

I have objects that are defined by the Entity Framework that I have then added additional methods and properties to via partial classes. I think I understand most of the limitations around doing this, but wanted to confirm something I am seeing (or hopefully learn what I need to do to make this work). I have a partial class that then h...

Logging every data change with Entity Framework

There is a need from a customer to log every data change to a logging table with the actual user who made the modification. The application is using one SQL user to access the database, but we need to log the "real" user id. We can do this in t-sql by writing triggers for every table insert and update, and using context_info to store th...

Entity Framework and Crystal Reports

As I understand it, Crystal Reports can use EntityFramework, is the correct? I'd rather use Entity Framework instead using datasets. How would I do this? ...

Linq to SQL and Entity Framework Diffrences ?

Anyone know what is the diffrences between those 2 asumming I'm using SQL Server as my database ? Are they the same ? ...

Linq to Entity - can i get to another table in the model when in the list template MVC page

in the out of the project template solution (Dynamic Data Web Application), I have the model created and all is good. - Get the list of the tables, and the select edit etc. But my database has linking tables that just contain forgien keys - so the list template just displays the fk value Is there away to combine the list of the row ...

Entity Framework Validation & usage

I'm aware there is an AssociationChanged event, however, this event fires after the association is made. There is no AssociationChanging event. So, if I want to throw an exception for some validation reason, how do I do this and get back to my original value? Also, I would like to default values for my entity based on information fro...

Will the .Net Entity Framework work with a .mdb?

Can use a .mdb file as the data source for an Entity Framework model using the Microsoft Jet OLEDB data provider? If so, how will I be limited? No stored procedures, for example. ...

Locating the getter and setter access modifiers in the EdmItemCollection of Entity Framework

I've been creating a nice T4 template for a repository pattern for my entities. Instead of manually parsing the xml in the edmx file I use the EdmItemCollection to create a object graph presentation for the conceptual model. I've been able to get a lot of information out of this model. But I cant find where to locate the Getter and Sett...

Multiple back ends for Entity Framework

Can I use two different back ends for an .net Entity Framework project? I need to support the full programmability support of stored procedures on SQL server when available. I need to support only table structures in a .mdb file when SQL server is not available. All business logic above the Entity Framework uses the entity abstratction...

How do I apply OrderBy on an IQueryable using a string column name within a generic extension method?

public static IQueryable<TResult> ApplySortFilter<T, TResult>(this IQueryable<T> query, string columnName) where T : EntityObject { var param = Expression.Parameter(typeof(T), "o"); var body = Expression.PropertyOrField(param,columnName); va...

How to correctly unit test my DAL?

I'm new to unit testing. But how do I unit test my DAL which is written with Entity Framework, so I can make sure my DAL code is working correctly but no database is actually touched? Could someone give as much detail as possible please. Thanks, Ray. Note: this post is relevant to my other post Mocking vs. Test DB? which is asked aft...

Entity Framework pipeline: Expression trees to ESQL to SQL?

What is the Entity Framework pipeline like? What gets translated to SQL, Expression Trees or ESQL, or both? Is ESQL something an Entity Framework provider needs to implement or translate, or that the framework takes care of? ...

Must I use all tables in an Entity Framework model?

I am building an Entity Framework model for a subset of the Pubs database from microsoft. I am only interested and publishers and books, not publishers and employees, but there is a foreign key constraint between the publishers and emoloyees tables. When I remove the employees entity from my model, the model won't validate because of the...

How do I get the max ID with Linq to Entity?

I have a table User which has an identity column UserID, now what is the correct Linq to Entity line of code that would return me the max UserID? I've tried using (MyDBEntities db = new MyDBEntities()) { var User = db.Users.Last(); // or var User = db.Users.Max(); return ...

Using SQL Server 2008 and SQL Server 2005 and date time

I've built a entity framework model against a 2008 database. All works ok against the 2008 database. When I try to update the entity on a 2005 database I get this error. The version of SQL Server in use does not support datatype 'datetime2 I specifically did not use any 2008 features when I built the database. I can't find any ref...

TDD and ADO.NET Entity Framework

I've been playing with ADO.NET Entity Framework lately, and I find that it suits my needs for a project I'm developing. I also find cool its non-invasive nature. After generating a data model from an existing database you are faced with the task of integrating the generated model and your business logic. More specifically, I'm used to i...

Optimize Group By in LINQ to Entities

I have this query in LINQ to Entities. var query = (from s in db.ForumStatsSet where s.LogDate >= date1 && s.LogDate <= date2 group s by new { s.Topic.topicID, s.Topic.subject, s.Topic.Forum.forumName, s.Topic.datum, s.Topic.Forum.ForumGroup.name, s.Topic.Forum.forumID } into g ...