entity-framework

generate only objectLayer of Entity Framework Model by edmgen tool

How to generate only objectLayer by edmgen tool, without generating csdl, ssdl and views ? "%windir%\Microsoft.NET\Framework\v4.0.30319\edmgen.exe" /mode:fullgeneration /c:"Data Source=.\sqlexpress; Initial Catalog=uqs; Integrated Security=SSPI" /project:generateEntityModel /entitycontainer:uqsEntities /namespace:uqsModel...

SQL, MVC, Entity Framework

Hi Im using the above technologies and have ran into what I presume is a design issue I have made. I have an Artwork table in my DB and have been able to add art (I now think of these as Digital Products) to a shopping cart + CartLine table fine. The system I have that adds art to galleries and user accounts etc works fine. Now the cl...

Linq to Entities custom ordering via position mapping table

Hi, I have a news table and I would like to implement custom ordering. I have done this before via a positional mapping table which has newsIds and a position. I then LEFT OUTER JOIN the position table ON news.newsId = position.itemId with a select case statement CASE WHEN [position] IS NULL THEN 9999 ELSE [position] END and order ...

EF 4.0 POCO relationship mapping problem

Hello I'm trying to use the new POCO support in EF4.0 but when I start having relationships, problems start to occur. Here is a screenshot of my model, mapping and POCO class. As you can see that relationship is ok in the model, but when you look at the mapping you see that there is something wrong. I think this is causing the InvalidO...

Which ORM to use?

I'm developing an application which will have these classes: class Shortcut { public string Name { get; } public IList<Trigger> Triggers { get; } public IList<Action> Actions { get; } } class Trigger { public string Name { get; } } class Action { public string Name { get; } } And I will have 20+ more classes, whi...

Process.Start() edmgen

after clicking on button in asp.net application process.start() runs edmgen tool with arguments. And I catch error : var cs =ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString; string myArgs="/mode:fullgeneration /c:\""+cs+"\" /project:nwd /entitycontainer:SchoolEntities /namespace:SchoolModel /langua...

How to remove column-duplicates from the query result using entity-framework?

On my database table I have Key | Value a | 1 a | 2 b | 11 c | 1 d | 2 b | 3 But I just need to get the items which keys are not duplicates of the previous rows. The desired result should be: Key | Value a | 1 b | 11 c | 1 d | 2 How could we get the desired result using entity...

How to connect to SqlExpress for Entity Framework using Visual Studio 2010 Express?

Hi everyone, I'm trying to use the Visual Studio 2010 Express editions to set up an ASP.NET MVC 2 Web Application using SqlExpress + Entity Framework as the data access. I have both the "C# Edition" and "Web Developer Edition" installed. If I try to add a data source using the "C# edition", I'm missing the "Microsoft SQL Server" data ...

Entity Framework, unmapped property and Dynamic Data

I'm using an Entity Framework data model to drive a Dynamic Data website for use by users to update data. One of the entities contains a non-nullable string property (Description). In the database, one of the rows has an empty Description (not null but an empty string). When I try to update the Description I get the following validation...

Binding Entity Framework Collections Simply Using ASP.NET MVC

To begin with: Using Entity Framework v4.0. ASP.NET MVC 2.0. Visual Studio 2010. I have a model that consists simply of an order & order items. What I want to do is simply bind that model without too much hassle where possible (avoiding type converters, etc). Simply the model looks like this: public class Order { public int ID { g...

Stopping Filter Display in Dynamic Data Entity Web App

I'm currently experimenting with the Dynamic Data Entity Web App Project type in VS2008 SP1 and after reading many tutorials which offer helpful advice for problems I so far have no need of a solution to I have fallen at the first hurdle. In the DB I have made my entity model from I decided to start small with a table called "Companies"...

create ddl from edmx. from command line.

Ho to create ddl (database creation swl) from .edmx file. By using command lime tool. ...

Solved: TryGetObjectByKey... empty ObjectSets

When I use TryGetObjectByKey on my ObjectContext, it returns an error. An item with a duplicate value already exists. When I look at my objectContext, I see that the ObjectSets are empty. What Am I doing wrong... When I enumerate the ObjectSet by hand, by using ToArray on it, or by using the debugger, it does work. LazyLoadingEnabled =...

Serialization of Entity Framework Models with .NET WCF Rest Service

I'm trying to put together a very simple REST-style interface for communicating with our partners. An example object in the API is a partner, which we'd like to have serialized like this: <partner> <id>ID</id> <name>NAME</name> </partner> This is fairly simply to achieve using the .NET 4.0 WCF REST template if we simply declar...

How to tell if any entities in context are dirty with .Net Entity Framework 4.0

I want to be able to tell if there is any unsaved data in an entity framework context. I have figured out how to use the ObjectStateManager to check the states of existing entities, but there are two issues I have with this. I would prefer a single function to call to see if any entities are unsaved instead of looping though all entiti...

Help me understand Entity Framework contexts (please!)

Through various questions I have asked here and other forums, I have come to the conclusion that I have no idea what I'm doing when it comes to the generated entity context objects in Entity Framework. As background, I have a ton of experience using LLBLGen Pro, and Entity Framework is about three weeks old to me. Lets say I have a con...

Entity Framework Security

In my organization, we are just beginning to use the Entity Framework for some applications. In the past, we have pushed developers to utilize stored procedures for all database access. In addition to helping with SQL injection, we tried to grant logins access to stored procedures only to keep security relatively tight. Although inser...

Association not imported in EF4 designer for non-primary key

The relationship 'FK_EXTERNAL_ISMARKETI_MARKETIN' has columns that are not part of the key of the table on the primary side of the relationship. The relationship was excluded. USE [Instruments.UnitTest] GO ALTER TABLE [Instr].[ExternalIdentification] WITH CHECK ADD CONSTRAINT [FK_EXTERNAL_ISMARKETI_MARKETIN] FOREIGN KEY([Instrume...

Is it possible to use separete ssdl, csdl and msl files for each Entity?

Is it possible to use separete ssdl, csdl and msl files for each Entity in EntityFramework? That is, I want to modularize the mapping information. Note: EdmGen.exe tool stores the ssdl, csdl and msl information in respective files for all entities. Note: If anyone used NHibernate, he should be aware of the fact that, NHibernate uses s...

EF 4 - associations with keys that dont match

We're using POCOs and have 2 entities: Item and ItemContact. There are 1 or more contacts per item. Item has as a primary key: ItemID LanguageCode ItemContact has: ItemID ContactID We cant add an association with a referrential constraint as they have differing keys. There isnt a strict primary / foreign key as languageCode isnt in...