entity-framework

Database doubly connected relationship inserting problem

I have two tables Plants and Information. For every plant there are many information, but for each plant there is a single MainInformation. So there is a one-to-many relationship and a one-to-one relationship between the two. The Information table has a PlantID and the Plants table has a MainInformationID. I want both fields in both tabl...

Visual Studio cannot find the EntityModelCodeGenerator custom tool

Hello all, I'm helping develop a MVC application in Visual Studio 2008 using the Entity Model Framework. I've gotten the code from the source control and I'm wanting to add some new Models from the edmx file. I right click and then click "Custom Tool" but then I get the following error. Cannot find custom tool 'EntityModelCodeGenerat...

LINQ To Entities - Items, ItemCategories & Tags

Hi There, I have an Entity Model that has Items, which can belong to one or more categories, and which can have one or more tags. I need to write a query that finds all tags for a given ItemCategory, preferably with a single call to the database, as this is going to get called fairly often. I currently have: Dim q = (From ic In mCont...

Need help understanding Generics, How To Abstract Types Question.

I could use some really good links that explain Generics and how to use them. But I also have a very specific question, relater to working on a current project. Given this class constructor: public class SecuredDomainViewModel<TDomainContext, TEntity> : DomainViewModel<TDomainContext, TEntity> where TDomainContext : Doma...

Entity Framework & Binding syncronisation

* EDIT * Sorry, I should make it clearer. Imagine I have an entity: public class MyObject { public string Name { get; set; } } And I have a ListBox: <ListBox x:Name="lbParts"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Name}"/> </DataTemplate> </ListBox.ItemTemplate> </List...

How does TransactionScope guarantee data integrity across multiple databases?

Hey guys, Can someone tell me the principle of how TransactionScope guarantees data integrity across multiple databases? I imagine it first sends the commands to the databases and then waits for the databases to respond before sending them a message to apply the command sent earlier. However when execution is stopped abruptly when sendi...

LiNQ to Entities, Include less

Hi, If you are making a LinQ to entities expression for ClassA where A has a relation to ClassB like this: var temp = from p in myEntities.ClassA.Include("ClassB") where ... select p; You will get a set of ClassA:s with the reference to ClassB loaded. The thing in my case is that I dont really need to load ALL t...

Capture Stored Procedure print output in .NET (Different model!)

Basically, this question with a difference... Is it possible to capture print output from a TSQL stored procedure in .NET, using the Entity Framework? The solution in the other question doesn't work for me. It works with the connection type from System.Data.SqlClient but I'm using the one from System.Data.EntityClient which does not ha...

Entity Framework - Medium Trust

I'm trying to get the entity framework working in medium trust. I've tried splitting the files and using a separate assembly but I seem to have one problem after another. I moved the EDMX to a separate assembly, which causes a single .dll to be outpit to the sites /Bin directory. I'm referencing this as below from web.config. <add name...

Entity Framework Vote of No Confidence - relevant in .NET 4?

Hi, I'm deciding on an ORM for a big project and was determined to go for ADO.NET Entity Framework, specifically its new version that ships with .NET 4. During my search for information on EF I stumbled upon ADO .NET Entity Framework Vote of No Confidence which I'm not sure how to take. The Vote of No Confidence was written sometime in...

Explicit casting doesn't work in default model binding

I am using ASP.NET MVC2 and Entity Framework. I am going to simplify the situation a little; hopefully it will make it clearer, not more confusing! I have a controller action to create address, and the country is a lookup table (in other words, there is a one-to-many relationship between Country and Address classes). Let's say for clari...

Converting sql query to EF query- nested query in from

Hey guys Just wondering how the following sql query would look in linq for Entity Framework... SELECT KPI.* FROM KeyPerformanceIndicator KPI INNER JOIN ( SELECT SPP.SportProgramPlanId FROM SportProgramPlan PSPP INNER JOIN SportProgramPlan ASPP ON (PSPP.SportProgramPlanId = @Sport...

Future of Linq to Sql and Entity Framework

I work on a project and want to use an ORM. What should I use: Linq to Sql or Entity Framework? Linq to Sql provides more opportunities, as I see, for example support for enumeration types. However, also it is said that, Linq to Sql was for playing and learning for Linq and future strategy of Microsoft lies on Entity Framework. So which ...

Calling Entity Framework function import from code

So I have a stored procedure called Spr_EventLogCreate defined in my database. I have created a function import in my data model called LogEvent with no return type, and I can see this function in the Model Browser tree at MyModel.edmx > MyModel > EntityContainer > Function Imports > LogEvent. I thought I should then be able to call t...

WPF Composite - Expose EF model to all modules

Hi All, I have an application that uses WPF Composite, and I have an issue. I've got a big database that is attached to the application and I need it exposed to different modules as part of the application. What is the best way to expose my Entity Framework model to all my different modules and views inside them? Do I have one EF mode...

Creating Entity Framework objects with Unity for Unit of Work/Repository pattern

I'm trying to implement the Unit of Work/Repository pattern, as described here: http://blogs.msdn.com/adonet/archive/2009/06/16/using-repository-and-unit-of-work-patterns-with-entity-framework-4-0.aspx This requires each Repository to accept an IUnitOfWork implementation, eg an EF datacontext extended with a partial class to add an IUni...

Unable to perform cast

Hi I need to have a wrapper class that exposes some properties of my entity class called ProfileEntity. I tried doing it by deriving from this entity and then creating properties that return specific entity properties, but it says I cannot cast from ProfileEntity to ProfileEntityWrapper. When I try to put the return values of a method...

Get @Return_Value from stored procedure using Entity

I want to get @Return_Value from stored procedure using entity. Lets say stored procedure is: CREATE PROCEDURE GetEmployes( @whereSql nvarchar(512) ) AS BEGIN set @tsql = 'select * from Employes where ' + @whereSql exec(@tsql) return 5 END Entity imports is as ObjectResult<Employe> GetEmployes(...) This is what I need...

how to install program that i made in VS2008 (FW3.5) on computer that has FW2.0 ?

hi is it possible to install program that i made in VS2008 (FW3.5) on computer that has FW2.0 ? i need it because FW3.5 weight 130Mb and FW2.0 only 24Mb thank's in advance ...

Does the Entity Framework 4 support generators for id values like NHibernate?

Does the Entity Framework 4 support generators for id values like NHibernate? NHibernate has generator classes to help with this. ...