entity-framework

Db schema is complete, can Entity Framework generate Storage Schema?

Hi, If I already have a database schema complete, can the entity framework somehow generate the storage schema for me? Or if I have the classes developed, can it generate the other xml's desribing the classes and their relationships? ...

Building a Decoupled N-Tier App With Entity Framework and VB.NET

So we are building an application with a UI Layer (web, mobile, Ajax client, etc) Service/API Layer Business Logic Layer Data Access Layer Our goal is to have an Entity Framework dependency from the Service Layer on down to the DAL. That means the Sevice layer will only accept and return POCOs (plain old CLR objects). What we're ...

How do I set the login info for SQL Server 2008 in Entity Framework?

Okay I'm still learning the ropes with the Entity Framework and I came across one more small issue. When I create my Entity Model from the SQL Server 2008 database it warns me about saving the login information in the connection string in the config file. Initially I wasn't concerned about that so I just left it in there, but now I want...

How to create foreign key relationships with the Entity Framework?

I want to create a new row in my database on a table that has a couple of foreign key relationships and I haven't been able to get a handle on what order and what calls need to be made. This is what I have so far: db.Models.Order order = DB.Models.Order.CreateOrder( apple ); order.CustomerReference.Attach( ( from c in db.Customer where ...

Unable to save Entity Framework Inherited types.

I have implemented some table-per-type inheritance in my data model (basically have a "BaseEntity" type with all the base information for my items and a "Employer" type that inherits from the "BaseEntity" item). Everything appears to be set up correctly and when using the Entities (either via ADO.net Data Services or via Linq to Entitie...

Filter EntityDataSource on Association value

I really like Entity Framework, but there are some key pieces that are a challenge to me. Can anyone tell me how to filter an EntityDataSource on an Association column? EF hides the FK values and instead has an Association property. Given an Entity, Person, with a PersonType association, I would have expected something like this to work ...

Automatically add some Where clauses to a Linq Expression Tree

I am using the Entity Framework and Linq to Entities. I have created a small database pattern & framework to implement versioning as well as localization. Every entity now consists of two or three tables, (ie Product, ProductBase & ProductLocal). My linq always includes the following boilerplate code: from o in DB.Product from b ...

Using Entity Framework entities as business objects?

I'm using Entity Framework O/R mapper from Microsoft and using entity classes (generated classes that are mapped to DB objects) as a business objects. Is this OK? Please state your cons or pros. What to do in a case of WCF communication between business layer and presentation, how to send those objects as data members? ...

How to count how many objects will be returned by an ObjectQuery<T>?

I am building an ObjectQuery like this: string query = "select value obj from Entities.Class as obj " + "where obj.Property = @Value"; ObjectQuery<Class> oQuery = new ObjectQuery<Class>(query, EntityContext.Instance); oQuery.Parameters.Add(new ObjectParameter("Value", someVariable)); I c...

Entity Framework model update on a remote machine

I'm building a web application that uses the Entity Framework. The files are located on a remote machine, the same is for the database and the web server. In visual studio (2k8sp1), the path to the project is: \\Server\Web\XXXX Now, I've generated the EF entities from the database, and later I've updated the database and added there a ...

ADO.NET Data Services Query Interceptor - can anyone tell me the VB syntax of this C#?

Hi folks, I am pretty new to VB.NET - and I'm struggling to convert the signature of the method in the following code snippet. The Expression<...>> bit. Thanks in advance. [QueryInterceptor("Orders")] public Expression<Func<Orders,bool>> OnQueryOrders() { return o => o.Customer.ContactName == HttpContext.Current.User...

In ADO.Net Data Services how do I check if an entity is already in the context?

I have an ADO.Net Data Service that I am using to do a data import. There are a number of entities that are linked to by most entities. To do that during import I create those entities first, save them and then use .SetLink(EntityImport, "NavigationProperty", CreatedEntity). Now the first issue that I ran into was that the context did...

How do I build a Linq Expression Tree that compares against a generic object?

I have an IQueryable and an object of type T. I want to do IQueryable().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName)) so ... public IQueryable<T> DoWork<T>(string fieldName) where T : EntityObject { ... T objectOfTypeT = ...; .... return SomeIQueryable<T>().Where(o => o.GetProperty(fi...

Ado.net Entity Framework debug visualiser

Does anyone know if there is a debug visualiser for this yet along the same lines and the linq to SQL debug visualiser? ...

How to use Defining Query in SSDL in Entity Framework? Advantages and Examples will be helpful.

Hi, I need some info about using the Defining Query element within the SSDL of the Entity Framework. Advantages of using it and scenarios where it would be helpful would really help. An example and links will be great. Kind regards. ...

Set Return Type of Stored Procedure to Auto - Generated using Entity Framework.

Hi, In LINQ2SQL it was possible to set the return type of a stored procedure to auto generated. I am unable to do so with the Entity Framework. I want to set the return type of a stored procdure to auto-generated with the Entity Framework. Is this possible? Kind regards. ...

Linq To Sql vs Entity Framework Performance

I have been searching for recent performance benchmarks that compare L2S and EF and couldnt find any that tested calling stored procedures using the released version of EF. So, I ran some of my own tests and found some interesting results. Do these results look right? Should I be testing it in a different way? One instance of the conte...

How should I get started learning about ADO.NET Entity Framework?

So here I am just about to start a big project using LINQ to SQL and then I read this: Is LINQ to SQL Truly Dead? by Jonathan Allen for InfoQ.com Well, I don't want to be supporting LINQ to SQL indefinitely if it's a dead end. So, how should I get started learning about ADO.NET Entity Framework? ...

Database (and ORM) choice for an small-medium size .NET Application

Hi I was hoping to get some advice from the panel. I have a requirement to develop a .NET-based application whose data requirements are, in the future, likely to exceed the 4 gig limit of SQL 2005 Express Edition. There may be other customers of the same application in the future witwh a requirement to use a specific DB platform (such...

How do I share DAL and BLL across multiple .NET applications?

I need to create several applications that all share a Microsoft SQL Server database. These include ASP.NET web applications, WPF desktop applications, and probably the odd console app every now and then. I'd like to use the ADO.NET Entity Framework for data access, extend its objects for my business logic, and bind those objects to co...