entity-framework

Entity Framework Class with Extra Field

Hi, im working with Entity Framework, SQL and C#. I have a table on SQL called Clients. I have to show the clients on a Grid in a Form and select some of the clients using a Check. So, i need 1 check for each client on the grid. I try with "Anonymous Types" but this are ReadOnly properties and i need ReadWrite properties. It is possi...

LINQ2SQL switch to EF on reading a list of records

I am trying to switch from LINQ2SQL to EF ... I am getting the following error with some code that originally worked with LINQ2SQL and seems to compile correctly: Csla.DataPortalException: DataPortal.Fetch failed (LINQ to Entities does not recognize the method 'MyApp.Logic.UserInfo FetchUserInfo(MyApp.Data.User)' method, a...

Entity Framework timestamp Generate Database problem

Hi. I got a problem with EF 4.0 I creating entity with "timestamp" column. After that, I try to generate database. In SQL script column looks like 'binary(8)' instead of timestamp. How to solve it ? ...

Linq to Entity get a Date from DateTime

var islemList = (from isl in entities.Islemler where (isl.KayitTarihi.Date >= dbas && isl.KayitTarihi.Value.Date <= dbit) select isl); It gives error: date is not supported in LINQ to Entities... How can i get date in linq. ...

[entity framework] multiple edmx in the same .net solution

hi I have 2 project in my .net solution.each one has entity data model.how I can make an association between two entities one in the first project data model while the other in the second project data model in the same solution? what if each data model mapped to different database? ...

Entity Framework CRUD operations on a datagrid

I have a List<T> bound to a datagrid and am trying to figure out how to save all the changes to the database (using Entity Framework), not just one row at a time; OR, at least a better way to commit changes from the datagrid to the database. I am using the MVVM pattern. Here is what I have as far as saving one row: private static P...

Using Stored Procedure with Entity Framework where SP Parameters don't match entity

I have stored procedures that take a user's username (to log who makes changes to the database) in addition to other information (like name, ID, email, etc.). Within the stored procedure I look up the user's ID and store that in the table. The issue I am experiencing is that the Entity Table does not match the input of the stored proce...

C#, entity framework, auto increment problem

Hi, I'm learning Entity Framework under VC# 2010. I have created a simple table for learning purposes, one of the fields is "id" type integer, indentity set to true. I've generated Entity Data Model from that table and connected it with dataGridView. The problem is that it doesn't auto increment - each inserted row wants to be id=0 (whic...

Using WPF Frameworks / Modules in Small Scale Development

I have read quite a few posts on SO and around the web of the benefits and features of various WPF Frameworks (Caliburn, Prism) and Module Frameworks (MEF, Unity) and combining them. In theory, I love the ideas behind them. And I know once I get a grasp on those systems, that it may actually increase development speed - but the upfro...

help with linq query

i have table id pagenane username i want this sql query select pagename, count(*) as num from pagestat where username='name' group by pagename how can i do it by linq? ...

Entity Framework switching between models

Hi, There is a legacy application in my company which is still in use. I am in the middle of porting it to asp.net (using mvc framework) and also have to create new functionality. Because it's in use I have to develop it on top of existing database, which was developed really badly (not all relations exist, triggers used instead of rela...

EF - and repository pattern - multiple contexts

I've faced some troubles with context in EF in ASP.MVC2. I thought that best way to improve some operation on DataBase i've created Repository. My repo class adds, deletes, select many items so i don't need to write (using <name>Context = new (... etc ...) ) { ... } Repository eliminates initializing context for every operation, but...

Entity Framework: join method

Hi, I spend enough time already so I need help from stackoverflow. Here is an entity Entity: Asset Field: AssetVersionID (int) PK Field: AssetID (int) FK Field: ReleaseTimestamp (DateTime) My task is to select assets with unique AssetID and with latest ReleaseTimestamp. basically I need function like this public IQueryable<Asset> ...

When is it NOT advisible to use an ORM like Linq-to-SQL / Entity Framework for a program?

Possible Duplicate: Are there good reasons not to use an ORM? I've just started learning what an ORM is and how it can help me save time and make applications more secure. Since this is new to me, after using ugly SqlCommands and whatnot in my C# code, this is the best thing since sliced bread. However since I'm new I might n...

XBAP with entity framework

Hello, I am trying to write a xbap application (WPF browser application). This application need to be very simple. It doesn't have services or logic and just reads data from database by using entity framework. However, I setup a reference to entity framework in my xbap app. It tells me that "that assembly does not allow partially truste...

EntityException timeout, deadlock etc...

Is there anyway of telling the underlying cause of an EntityError? The SqlException has a 'Number' field you could map to a deadlock, timeout, connect error etc.. For example :- ((SqlException)e).Number == -1 //Connect Error Thanks in advance. ...

why SaveChanges invokes when i'm debugging?

I am developing application using Entity Framework. When i'm in debugging mode my test values are saved into database when i exit debugging even if i'm not hitting SaveChanges method. Why is this happening? I spent 4 hours trying to figure it out, but had no luck.... Even if i have my breakpoint at the start of the action, and i ex...

How to Achieve Group Results by Max Date in Entity Framework

I have the following data structure (it's an append only table for mapping content to a page zone in our proprietary CMS system). - RowID INT IDENTITY - PageID INT FK - ZoneID INT - ContentID FK - DateAdded DATETIME I am using Entity Framework, and want to use LINQ to Entities to get a list of these records where the ZoneID ...

Error after Attach() Detach()

I have a RadGrid that uses EntityDataSource bound to Customer table in Northwind. It is the basic auto-everything setup. This code will give the following error after editing the data and clicking Update in the edit form: The object is in a detached state. This operation cannot be performed on an ObjectStateEntry when the obje...

How do I deploy dlls to a system's GAC and check for their existence on program startup?

Entity Framework references some DLLs. On one system, they showed up in the GAC which is very convenient. I can't figure out how I did this. The installer doesn't seem to do this -- The dlls I'm specifically talking about here are: The core library assembly Microsoft.Practices.EnterpriseLibrary.Common.dll The Unity Application Block a...