LinQ to Entities: Lambda expressions
Hi! I want to translate this var db = new PracticeEntities(); var destinations = db.DestinationDetails. Where(dd => dd.Language.Lang == "en-US" ...
Hi! I want to translate this var db = new PracticeEntities(); var destinations = db.DestinationDetails. Where(dd => dd.Language.Lang == "en-US" ...
I am fairly new to the MVC Framework and have spent the last few days/nights working through the tutorials. I have a loosely coupled design with Services and Providers and am using the Entity Framework. I am using all the latest software, Visual Studio 2008, .Net 3.5 Framework, MVC, Entity Framework. I'm trying to create a view Artist/C...
Well I've been reading a couple of posts on this here on Stackoverflow but I'm still not not sure about the direction to take. Basically I'm developing a product which I will maintain for the next 10 or more years so I want to decide now as to which framework to stick with. So I need expert advice as to which framework I should adopt t...
Hi, I am trying to save my contact, which has references to ContactRelation (just the relationship of the contact, married, single, etc) and Country. But everytime I try to save my contact, which is validated I get the exception "ADO.Net Entity Framework An entity object cannot be referenced by multiple instances of IEntityChangeTracker...
I have a Foo entity in Entity Framework. But I'm making it inherit from IFoo so that my business logic only knows IFoo - thus abstracting Entity Framework away. The problem is that Foo has a collection of Bar entities. And this collection is of type EntityCollection<Bar> . If I put this collection in IFoo as it is, I make IFoo depende...
Hi, can anyone give a helping hand, I been watching the videos for the mvc storefront and have create my own website using these techniques i.e. DDD, Repository pattern but i wish to use Entity Framework. In the Interfaces it returns IQueryable but with the entity framework i should return ObjectQuery instead? - I will be using LINQ. ...
I am trying to create a very generic generics repository for my Entity Framework repository that has the basic CRUD statements and uses an Interface. I have hit a brick wall head first and been knocked over. Here is my code, written in a console application, using a Entity Framework Model, with a table named Hurl. Simply trying to pul...
Hi, Is there a difference between the terms Entity and Object? ...
Hello, I have stored Procedure getSalesOrder() returning a row structure like this: Order (map with EF), customfield1 , customfield2 ,customfield3. How can i use EntityFramework to get the order, and custom Fields Values ? ...
We have a class library (ProjA) which has L2E object context. This will be used in an Website (ProjB) and WCF Service (ProjC). How do I specify the connection string in the website (ProjB) web.config so that it uses the resource files from the class library project (ProjA). connectionString="metadata=res://*/db.csdl|res://*/db.ssdl|res:...
I have a simple Entity Framework. For simplicity's sake I will transform the entity names to Northwind Like. I have a IEnumerable Of Customer and Item Objects I am trying to Create Orders which of course is made up (simplistically) of an Item and A Customer. How can I go about creating and inserting these Orders? -Hcane ...
Is there a way in entity framework or linq to sql classes to map one class to many different tables with the same schema. For example if I have a database with thousands of tables for different stocks. All of the tables have the same columns. Is there a way I could have a base type class that could be used for mapping the data to an o...
I am using the entity framework and I'm having a problem with "re-finding" objects I just created... basically it goes like this: string theId = "someId"; private void Test() { using(MyEntities entities = new MyEntities()) { EntityObject o = new EntityObject(); o.Id = theId; entities.AddToEntityObject(o); CallSomeO...
I have a complete separation of my Entity Framework objects and my POCO objects, I just translate them back and forth... i.e: // poco public class Author { public Guid Id { get; set; } public string UserName { get; set; } } and then I have an EF object "Authors" with the same properties.. So I have my business object var auth...
I have 2 tables: tblAuthors - id - username tblPosts - id - authorid So if I create a new Post var post = new Post { Id=Guid.NewId(), Author=new Author { UserName="username", Id="id in database } }; The author of the post is already in the database, but the post itself is not... So I want to do: entities.AddToPosts(obj); b...
I'm very confused when it comes to what actually decides the session time-out. The web app needs to allow for a 20 minute "idle time" before logging (or throwing) users out. I've tried different setting on both sessionState and Recycle worker processes in IIS. The time-out remains too short and, as far as my quit-n-dirty, primitive tes...
So I was doing some profiling of different ways to hit my SQLServer database. I did vanilla TSQL, a CompiledQuery, and a noncompiled Linq statement. The performance went in that same order, as expected, but I noticed something curious when profiling the latter two. The SQL generated by the CompiledQuery was MUCH better than what was g...
Hi, in this MVC tutorial it showed how to decouple Controller from database logic using Repository and a Service layer. However the example is for a very simple model of pure properties. What about associations? Say if Product model has an association to the Users table through Owner association. The controller calls the service or the ...
I am currently trying to bind an entity to a form however I want to have DataConfidenceLevel (see below) bound to a combobox with ConfidenceDescription as the display member. What is the correct way to populate the combobox? (I am currently using WPF but a Winforms answer is acceptable) Thanks ...
The entity framework appears to use excessive amounts of memory when inserting new objects into a database. for(int i = 0; i < numOwners; ++i) { var owner = Owner.CreateOwner(); db.AddToOwnerSet(owner); for(int j = 0; j < numChildren; ++j) { var child = Child.CreateChild(); owner.Childs.Add(child); ...