entity-framework

Entities Framework 4 doing a bulk delete

I wish to know if there is a good way to do a bulk delete or delete multiple rows using the Entities Framework 4. I can't seam to find a DeleteAll command. The only one that is available is DeleteObject() which only takes one entity, I would like to perform a delete on a list of entities.Is there a better way than to loop trough the list...

Entity Framework and Modeling Collections with an Interface as a return type

I am using Entity Framework v4. I have created a POCO class that contains a bunch of scalar properties and a collection that returns an Interface type. How do I create this relationship in the EF model? How do I show a collection that contains different items but they all have a common interface? Here would be an example of what I a...

Ado.Net entity framework

Hi, (a)- Is their any possibility that I can map two tables from the different database ( say sql server 2005 and oracle 10g) through aso.net entity framework. also, one more query (b)- I have worked around on the difference between entity framework & linq and I found that to use entity framework when we have one to many or many to man...

How to make Entity Key Mapping in Entity Framework like sql's foreign key?

I try to give entity map on my entity app. But how can I do it? I try to make it like below: var test = ( from k in Kartlar where k.Rehber..... above codes k.(can not see Rehber or not working ) if you are correct , i can write k.Rehber.ID and others. i can not write: from k in Kartlar where k.Rehber.ID = 123 //assuming that naviga...

How to add entity object to adequate entity set with object context in EF?

I have a problem when I add an entity object with ObjectContext.AddObject method because I can't retrieve that object with LINQ querying my ObjectContext.Person entities. I know that this new added object is stored somewhere, because it is used to update database after SaveChanges method. That's bothers me because I want to update my dat...

Error: FormatException was unhandled by user code in Linq how to solve?

Look please below this codes throw me : FormatException was unhandled by user code Codes: satis.KDV = Decimal.Parse((from o in genSatisctx.Urun where o.ID == UrunID select o.Kdv).ToString()); How can i rewrite linq query? ...

EntityFramework & RowNumber

Hello. How can I query RowNumber with Entity Framework? For example: var result = data.Users .OrderByDescending("Birthday") .ThenBy("LastName") .ThenBy("FirstName") .Select(u => { RowNumber = ???, u.Fi...

LINQ EF not saving to database...

I guess this is a continuation of the last question I asked: http://stackoverflow.com/questions/2587542/bulk-insert-and-update-with-ado-net-entity-framework. I am not getting any errors while doing inserts yet no data is actually going into my DB. My DB is a SDF file (SQL CE). Any ideas what to check? My app.config looks like: <?...

LINQ Join for Orderby only

I am trying to run this code: ItemTaxonomy iTaxonomy = from itemTaxonomy in connection.ItemTaxonomy where itemTaxonomy.Item.ID == itemView.ID orderby itemTaxonomy.Taxonomy.Name select itemTaxonomy; When I compiled it I get the error: Cannot implicitly conve...

Generic data input form in asp.net mvc application

Hello, I have an application that have EF 16 classes that share this information: They all are classes only with a key field and a description. I think it should be a waste if I make a controller with just 1 method just to present a form to fill these classes info, then I was thinking in to make a generic form(with key, description) and ...

Need Help on entity framework

I have 3 tables(Roles,Actions and RoleActionLinks). Roles table has few columns(RoleID,RoleName,Desc). Actions table has few colums(ActionID,ActionName,Desc). In RoleActionLink is created for store the association between Roles and Actions and this table has the columns such as RoleID,ActionID When I created the data model(edmx). it sho...

Clear an EntityCollection and then Add to it within the same transaction doesn't seem possible

Hi I have 2 entities a Department and an Employee. 1 Department can have many Employees. I would like to clear all the Employees from an existing Department, and also add a new Employee to that same department and then save the changes. It must be within a single transaction. However when I try execute the code below I get a key violat...

How to map a 0..1 to 1 relationship in Entity Framework 3

I have two tables, Users, and Address. A the user table has a field that maps to the primary key of the address table. This field can be null. In plain english, Address exist independent of other objects. A user may be associated with one address. In the database, I have this set up as a foreign key relationship. I am attempting to...

mvc update creating not updatng in entityframework

IM using c# and MVC and the entity framework, now i have an entity that i am passing through to the model of the view for an update, my edit post back takes back the entity and a few extra fields that i am using editors for. i have a repository manager and it has a entity context, however when i call savechanges on my repository base (sh...

ASP.NET check if LinqToEntities returned something or not.

How to make this method return boolean value, depending on query return. False - nothing, True - data exists. Before i just returned int from uniqueQuote.Count() but does not look like great method. Thank you! private bool CheckEnquiryUser(int enquiryId, Guid userId) { int selectedEnquiryId = enquiryId; ...

Entity Framework to WebService

Hi, I'm starting to work with Entity Framework as ORM. But my question is: is it correct and possible to map entities between Entity Framework and WebServices? The question is because we need to query data from a web service (method) to our application, and also we need to consume a webservice (method) to store data; so we want to keep ...

EntityFramework EntityState and databinding along with INotifyPropertyChanged

Hello, all! I have a WPF view that displays a Shipment entity. I have a textblock that contains an asterisk which will alert a user that the record is changed but unsaved. I originally hoped to bind the visibility of this (with converter) to the Shipment.EntityState property. If value = EntityState.Modified Then Return Visibility...

Entity Framework Polymorphism

Hey guys, I wanted some help with trying to implement a simple polymorphic relationship using Entity Framework. An example of a relationship I would like to implement: Comment table ItemType ('Video', 'User') ItemID Body Video has many Comments User has many Comments No idea the best way to do this, I c...

Adding Custom Filters for Dynamic Data Website (VS2010, EF4)

Trying to add some different filters (in addition to the ForeignKey filter) to a Dynamic Data Website in VS2010 using EF4. I can add the new Filter templates, but how do I specify which template will get displayed for each property in my model? Thanks ...

Entity Framework Reusing Connection

in a using block for a connection to the entities, How am I to reuse the connection when calling another method? so I have: using (SampleEntities entities = new SampleEntities()) { entities.Connection.Open(); SomeMethod(); ... } void SomeMethod() { using (SampleEntities entities = new SampleEntities()) { // ...