entity-framework

What ORMs are capable of building up an entity from tables belonging to several physical data sources?

I am checking if I can use Entity Framework or NHibernate to build a conceptual model where fields of some classes are mapped from different physical data sources. EF looks promising, at least on paper: this blog post mentions that "you can mix and match a number of different database vendors, application servers or protocols to design ...

EF where to create and dispose a context? In business layer or in the repository?

Is it better to create and dispose a context in the repository class? or is it better to create the context in the service and pass it to each repository through dependency injection? If it is only created in the repository, the methods cannot do lazy loading (no use returning IQueryable) in the service/business layer. ...

When creating database for enterprise applications, is it any useful to keep create date

I have just started with professional programming and my manager tends to dictate that i keep create, modified and delete date in all database tables that we use. I want to know does it makes sense to keep these fields for enterprise application. The reason I am asking it that because all examples, tutorials i have ever read on net, book...

Cannot update entity in Entity Framework 4 using POCO

I have 2 tables : Item and Location (one - many ). I select one location and I try to update it The entity goes from {Id=2, Name="name1",City="city1",Items=null} to {Id=2, Name="name1", City="city2",Items=null} and i want to save the updates. The update method from the base class is: public virtual void Update(T entity) ...

What library is used to access SQLite in my application?

My little SQLite testing application is working, and everything is 100% functioning as expected. For learning purposes, I'd like to know what library is allowing me to communicate with my Scans.db SQLite database. I was told that I'd need the System.Data.SQLite reference, but my application works and I don't see it referenced anywhere. ...

Best way to handle unique constraints when using Entity Framework

I'm using Entity Framework 4.0 to access data in a table with a unique column constraint. If the constraint is violated, an exception occurs when I call SaveChanges(), as expected. My question is whether I should allow the exception to be thrown in the first place. I could alternatively do a select to avoid inserting the duplicate dat...

Linq to Entities - Query errors in Web but not Unit tests

Hello, I have a query that errors out when I use it in a MVC 2.0 project, but not when I run unit tests against it (works fine). Below is the query, "User" is an entity. The error I get shows up on the Known issues to consider for EF (http://msdn.microsoft.com/en-us/library/bb896317.aspx) but it seems pretty basic this should work, an...

WCF for web sites?

Hello community. I'm working For my company on a .NET N-tier architecture and have several questions. Basics: the project should be split into layers and should not allow tues develop as easy as possible additional modules for modules like logging, ratings, user management etc. Environment: VS2010, EF4, SQL Server 2008, LinqToSql, c# ...

What format does the TreeView control need in order to create a Tree?

I have a simple table in my database called Department. In it there's a column called ParentDepartmentID that is a self referential foreign key ID. Here's an example of the data I have for testing purposes: As you can see, Departments: Diagnostics and XRay are children to Office of Chancellor. And Laboratories is child to Diagnostics....

How to save multiple entry for one entity in the same batch . Entity - Relation(One to Many) concept is use in my example.

Here is a common scenario I Have these Entity User UserId UserName ... UserQuestion UserQID UserID UserQuestion UserAnswer When the user first logon, he need to create 3 customs Answer / question. How can I Create these 3 questions relation and save it to database. I Want these questiona in relation with the specific user. ...