Entity Framework v2 cache
In EF v1 when we used GetObjectByKey on our context object contrary to linq query it stored queried object in cache is there any change in EF v2 (.NET 4) ? ...
In EF v1 when we used GetObjectByKey on our context object contrary to linq query it stored queried object in cache is there any change in EF v2 (.NET 4) ? ...
Is it possible to pass a SQL script to some method that Entity Framework has to run it against my model? e.g. equivalent of: context.ExecuteStoreCommand(<tsql script path>); Background: I want a way to reset the database during unit tests, and making a call to run the EF generated TSQL script (from Generate Database from Model) seem...
I'm having a hell of a time getting WCF Data Services to work within Silverlight. I'm using the VS2010 RC. I've struggled with the cross domain issue requiring the use of clientaccesspolicy.xml & crossdomain.xml files in the web server root folder, but I just couldn't get this to work. I've resorted to putting both the Silverlight Web A...
Hi, what's the shortest way of returning an Entity Framework object from one table based on it's name attribute? So say one had a table person, with column name, what would be the quickest way to return the person object with name = "Tim" say? e.g. context.People.Select(m => m.Name == "Tim") doesn't seem to work? ...
Hi, In entity framework is there a way to have a default value for a column such that Linq to Entity won't require this parameter when constructing a new object? For example I've marked on column in the EF designer with a default value (I typed in "All" as it was a string). But if I try to construct a new record and not specify this p...
Hi, I have a Entity Framework design with a few tables that define a "graph". So there can be a large chain of relationships between objects in the few tables via concept of parent/child relationships. What is a performance way to 'tree-walking' through my Entity Framework data? That is I assume I wouldn't want to load the full set o...
does Entity Framework support database views? ...
Hi, I have a model which includes NODES, and RELATIONSHIPS (that tie the nodes together, via a parent_node, child_node arrangement). Q1 - Is there any way in EF / Linq-to-entities to perform a query on nodes (e.g. context.Nodes..) to find say "all parents" or "or children" in the graph? Q2 - If there's not in Linq-to-entities, is th...
I am looking at multi-tenancy database schema design for an SaaS concept. It will be ASP.NET MVC -> EF, but that isn't so important. Below you can see an example database schema (the Tenant being the Company). The CompanyId is replicated throughout the schema and the primary key has been placed on both the natural key, plus the tenant I...
I'm new to MVC and ADO.net Entity Framework. Instead of having to create an edit/display for each entity, I'd like to have the controller base class generate the view and validation code based off metadata stored in a table - something along those lines. I would imagine something like this has already been done, or there are good reas...
Hi everybody I use EntityFramework as ORM and I have simple POCO Domain Model with two base classes that represent Value Object and Entity Object Patterns (Evans). These two patterns is all about equality of two objects, so I overrode Equals and GetHashCode methods. Here are these two classes: public abstract class EntityObject<T>{ ...
I am working on a project using entity framework. Is it okay to use partial classes of the EF generated classes as the business layer. I am begining to think that this is how EF is intended to be used. I have attempted to use a DTO pattern and soon realized that i am just creating a bunch of mapping classes that is duplicating my effort...
HI all I was trying to follow the POCO Template walkthrough . And now I am having problems using it in n-tiers design. By following the article, I put my edmx model, and the template generated context.tt in my DAL project, and moved the generated model.tt entity classes to my Business Logic layer (BLL) project. By doing this, I could...
For example, I have: originalItem.Property1 = currentItem.Property1; originalItem.Property2 = currentItem.Property2; originalItem.Property3 = currentItem.Property3; originalItem.Property4 = currentItem.Property4; The properties will also change if the currentItem's property's value is different from that of originalItem's. Any shortc...
I am trying to write a generic one-size-fits-most repository pattern template class for an Entity Framework-based project I'm currently working on. The (heavily simplified) interface is: internal interface IRepository<T> where T : class { T GetByID(int id); IEnumerable<T> GetAll(); IEnumerable<T> Query(Func<T, bool> filter); } G...
Is there any ORM that offers APIs to be used programatically? In my situation, a user will be helped through a wizard to define some entities. Thereafter those entites will be created in a database in form of tables (there will of course be some improvization). I need an ORM that offers APIs for modeling and creating entities during ap...
I'm using AdventureWorks database and created a ADO.NET Entity file (*.edmx) and I selected all tables. Now I created a custom entity named SalesOrder and I created some scalar properties in that entity names OrderID,OrderDate,CustomerID,CustomerType and I tried to map the OrderID,OrderDate,CustomerID with SalesOrderHeader respective fie...
Hi i am trying to find solution for using resource file with dynamic data based on EF 4.0 [TableName(Resources.Test)] public class TestTable .... I get an error An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type. How to do it right way? ...
Every time I update my data model, it makes this value 2008, breaking the 2005 server deployment. Is their anything besides a build action I can use to stop this? ...
If you build the edmx file from the database and then the db changes, how do you get the model to pick up the change? Do you delete the whole model and regenerate or can you detect changes? I see a post mentioning a "Update Your Model" rt. mouse command on the edmx file, but I dont see it. http://stackoverflow.com/questions/690248/upd...