entity-framework

How to organize model repository while using Entity Framework?

I have dilemma about how to organize connection (repository class) to data layer in my application that uses the Entity Framework. How would you write it? And why? public class ResearchRepository { public Research GetResearch (int id) { using (MnijenjeEntities mnijenjeContext = new MnijenjeEntities()) { ...

How to slice/filter data in Entity Framework Model?

Each our table has column TenantID. Normally we slice data with NHibernate filters. We need the same for Entity Framework Model. We will use this model as source for ADO.NET Data Services, so it is better to have model free of infrastructure properties like TenantID. From code side we know TenantID thread statically. UPD: I found Quer...

Entity Framework v1 Modelling Many-to-Many Lookup Table Relationship

I have the following database tables: Table1: UserUserIdUsername Table2: RoleRoleIdRolename Table3: UserRoleUserIdRoleId A User can have many Roles and a Role can have many Users. When I model this with EF, I get a User entity with a list of UserRole entities. What I want is a User with a list of Role entities. Is there a way to ...

How to register Firebird data provider for Entity Framework?

How do I register a Firebird data provider to use it with Entity Framework? What should I do to make it appear in the Entity Data Model Wizard/Choose Data Source window? I expect it to appear in the Data sources: or Data provider: lists. Is it possible? Or I need to configure this connection another way? PS: The provider I'm trying to ...

Error 11 Error 2002: The EntityContainer 'SomeEntitieContainerName' for the conceptual model specified as part of this MSL does not exist in MetadataWorkspace.

I'm getting this error when I try to compile my webapplication. I have only an *.edmx named BancorlineDB.edmx that has a "Entity Container Name" setted to "BancorLineEntidades". ...

Entity framework: eager load whole self-referencing table

Hi, i have standart self-referencing table of categories. In entity model i have made association "Children" and "Parent". It is possible to load whole Category object without lazy loading? if i use the code bellow, it's load only to second level (depth). db.Categories.MergeOption = System.Data.Objects.MergeOption.NoTracking; var q...

How do set up PostgreSQL + entity framweork ?

The npgsql ado.net provider claims to support the entity framework. Is there any documentation/guide how to set this up, and get me jump started here ? ...

How do I view the SQL generated by the entity framework ?

How do I view the SQL generated by entity framework ? (In my particular case I'm using the mysql provider - if it matters) Duplicate: http://stackoverflow.com/questions/137712/sql-tracing-linq-to-entities#138109 ...

Entity Framework, Stored Procedures,ASP.NET GridView - Insert Empty Row

I want to add a empty row in my Grid. <asp:TemplateField> <ItemTemplate> <asp:ImageButton id="Insert" runat="server" CausesValidation="false" CommandName="Insert" OnClick="GridViewInsert" ImageUrl="~/Images/Grid/Insert.gif" /> In GridViewInsert Event: Award_Status_List list = new Award_Status_List(); list.Award...

ADO.NET data services or Entity framework - Which one to learn?

Hi, I am having a bit of a free time and i am planning to catch up on some new technology. I started of my .NET development career as a ASP.NET developer. Presently I am done with ASP.NET development,for that matter i am done with any front end development. These days i am into Business layer and DAL development with the primary focus o...

C# Query an entity by using multiple parameters

What am I doing wrong. I get an error that says sequence has no arguements. PumpSUM.tblcards card = ps.tblcards.First(p => (p.PinId == 1223 && p.CardId == 321)); ...

ADO.NET Entity Framework in asp.net suited for different database & its performance

ADO.NET Entity Framework in asp.net suited for different database. Performance in Enterprise level web application or medium level web application. Is it the best alternative to other orm tools like linq, NHibernate. ...

Accessing the relationship of a relationship with Entity Framework

I the School class I have this code: from student in this.Students where student.Teacher.Id == id select student The Student class there are two relationships: Teacher and School. In the School class I'm trying to find out all the students whose Teacher has a given id. The problem is that I get System.NullReferenceException: Obj...

Entity Framework in Partial trust environment

I know that Entity Framework supports Partial trust, I personally blogged about that It was working fine, I tested it and it was fine. Now if you download the samples attached to my post about the subject, it doesn't run under default partial trust anymore!!! When I dug into System.Data.Entity assembly using reflector on the position ...

How to access the Entity Framework

I have mapped the database in the edmx file from the database. Now how do I use linq to make a query? here is an example of my problem var Found = from o in ?????? What suppose to go in the question marks. How do I find what suppose to go in the question marks. I have tried many tutorials but that do not tell you exactly how to use L...

Entity Framework - How to Set Association Value ?

Let's say I have a Person class and an Order class, with foreign keys in the DB. The EF model will mark Person with a List of Orders and Order with a Person instance. If I want to set the Person for the Order, do I really have to do it with an instance of Person? Is there not a slimmed down way to do so, say with just a PersonID ? ...

.Net Declarative databinding in nTier

I have an existing .Net single tier web app that is built using declarative data binding in the markup using EntityDatasource objects. I am in the process of extracting out the layers (Business Logic, Data Access) from the UI and migrating this to a ntier app. This app is using Declarative data binding. e.g.: <asp:DropDownList ID="...

Entity Framework -- How are Canonical Functions Different from Linq -- Linq-to-Entities vs Canonical Functions

I am reading up on the entity framework and the author is explaining ESQL, canonical functions, and Linq. he does not explain what canonical functions are and why they are needed. The code that he uses in the book can be easily converted to Linq. Where do canonical functions play in the Entity framework? Can I use canonical functions ins...

Is It Possible To Setup An Interface Library For A DAL Using Entity Framework?

Ok, so it seems the quick answer is "Of Course" but here's my delimma... I have a model library (namespace Test.App.Model.EF) with the Entity Framework implementation in it. This has all of the entities provided in the EF designer for me which I want to use. Within this Model.EF implementation, I have several repository classes. I wa...

IQueryable Count method takes longer to execute.

With a WCF built on top of a DB containing around 200 tables and Entity Framework, it takes lot of time (around 2 mins) to perform login the first time after building the WCF. Stepping into the code revealed the IQueryable.Count method to be the culprit. This happens only the first time after building the WCF code. Consecutive executio...