entity

entity framework: How to relate 2 tables..

I have following tables: Profiles: ProfileID (Primary Key) ProfileName, etc. Contacts: ContactID (Primary Key) ProfileFromID (Foreign Key) ProfileToID (Foreign Key) Message varchar(50) , etc. Profiles could have many contact messages. So a given message will have who sent the message and to whom the message was sent. I am having di...

IEqualityComparer for class with many properties

Hi all, which is the best implementation for IEqualityComparer for this class ?? The entity has 7 properties. Thanks in advanced. [Serializable()] public class ServidorSeleccionadoDto { [XmlAttribute()] public int Id { get; set; } [XmlAttribute()] public string Nombre { get; set; } [X...

Call Function Import from custom ObjectContext

I have an object that inherits the EF ObjectContext object and I want to call a Function Import I created. Anyone know how to do that? Do I have to use ExecuteFunction()? Thanks! ...

Case against stored procedures?

Any thoughts/comments on a database with over 3,000 stored procedures querying/accessing over 1,400 tables (overly normalized). Really want to use technologies such as Entity Framework, preferrably 4.0, and get the business logic out of those sproc's? Appreciate any real-life practical experience & feedback if you decide to share. This...

Hibernate: send entity through TCP lose persistentbag(or not update it)

Hi all, i have an entity with a @OneToMany relationship: @OneToMany(mappedBy="a", fetch=FetchType.EAGER) @Cascade(CascadeType.SAVE_UPDATE) private List<B> bList; Im writing a server/multiclient app: a client send A to server and server resend A to other clients. So, client1 send A with bList that has size 3. Server receive A entity, b...

Aggregates and Value Objects: Delete?

Hi, I'm currently determining the entities, value objects and aggregates in a system. Say the following Entities have been identified: Customer, CustomerEmail, Email, CustomerAddress, Address, AddressType where Customers -> Emails is a many to many relationship, as is Customers -> Addresses (with an address type). These relationships ...

[hibernate] Can i send an @entity through TCP java socket?

Hi all, all my test fails ... so is possible send an @entity using a TCP socket? UPDATE Problem is related at this post http://stackoverflow.com/questions/3097269/hibernate-send-entity-through-tcp-lose-persistentbagor-not-update-it Thanks. ...

Updating entites in Dynamics CRM 4 through the CRM-webservice takes forever...

Im having some trouble with Dynamics CRM 4. Im trying to update prices and availability with the crm-service in a WPF-app but it takes forever. Up to half an hour with about 6000 products. Should it take so long? Can I do this in some other quicker way? QueryExpression query = new QueryExpression(); query.EntityName = EntityName.product...

How can I undo changes when a SaveChanges() doesn't succeed ?

How can I undo changes when a SaveChanges() doesn't succeed ? contextObject.Toto.AddObject( new Toto()); try { contextObject.SaveChanges(); } catch { // Undo changes ! } In this sample, I'd like to remove the new Toto object in memory. I don't want to remove it manually. I'd like to synchronize my contextObject to my databa...

XML entity references

I need to represent special characters like superscripts, copyright symbols etc in XML. What's the best way to do this? I'm confused as XML defines 5 entity references for "<" , ">" etc. I always use < and > but could, or should, I use Unicode decimal, U+003C, instead? Or will an XML processor treat these the same as if I'd typed "<"...

Entity Framework: Getting objects not immediately related

I am using Entity Framework for my .NET application. I have been able to return objects and their directly-related objects as well (very convenient), but I am having trouble getting the objects of those objects. IEnumerable<Lot> i = (((ObjectSet<Car>)_carRepository.GetQuery()) .Include(a => a.CarType...

ASP.Net MVC 2 - Model Coupling with Repository

Referring to this question, let's say we have the following scenario - A model class User that implements IUser [MetadataType(typeof(IUser))] public class User : IUser And a repository that handles saving, retrieving etc. of this from whichever datastore we want to use public class UserRepository : IRepository<User> IQueryable<User...

entity framework 4, code-only, relationships

Hi, I can't figure out how to solve the following problem. What i need it a relationship from one base class to another, so that every derived class has a relationship with the same table, called 'Item' in my example. Since this is just an example it doesn't reflect my program. In the real program the relationship with class Item is in...

Server-side validation of a REQUIRED String Property in MVC2 Entity Framework 4 does not work

I'm trying to get server-side validation of an Entity Framework String Property to work. Other server-side validation such as data type validation and required dateTime and numeric EF properties are working. This in VS 2010, .Net 4.0, MVC2 + Cloud, ADO.Net Entity Framework. The String Property I am having issues with is mapped to a SQ...

Can entities in Entity Framework inherit from an entity that is not mapped to a table?

Hi, I am using Entity Framework POCO to generate some self-tracked data objects, and I exposing these objects from a WCF service interface. I have EntityA & EntityB, which both map to different tables in the database. I would like both EntityA and EntityB to inherit from a base 'Entity' class, so that I can implement a simple WCF serv...

Entity framework - Create entity to multiple related tables

We have three tables. TableA relates to TableB and TableB relates to TableC. Is it possible to create a new entity framework entity composed of all three tables without using a stored procedure or view? It only seems to allow one level of mapping where we have two in this case. Any help or tutorial appreciated. ...

entity framework: how to assign foreign key in a entity..

Hi all, Here is my tables structure.. Profile: ProfileID (PK), ProfileName varchar(50), GenderID (Fk) Gender: GenderID (PK), GenderName varchar(50) Gender table has 2 possible values : Male, Female. In entity framework, when I am updating the profile with GenderID, I use the following code: profile.GenderID = Repository. ...

EF, TPT and foreign key problem

Hello I have a problem with TPT inheritance + foreign key. I'm working on a web application with multi language support, including translating dynamic content. Here's my tables: Language Id, Name ProcessingAgent Id, some other fields LocalizedProcessingAgent LocalizedProcessingAgentId, Name, Description, LanguageId As you alread...

GetHashCode with transient/persistent entities

Hiya, I'm implementing a layered supertype that all my entities will be based on. I am currently working on the Equity methods Equals and GetHashCode. I have the following for GetHashCode: public override int GetHashCode() { if (!_hashCode.HasValue) { if (this.Id.Equals(default(T))) { ...

Layer Supertype with Entity Framework...

I was wondering if anyone had any success implementing a layer supertype for their Entities using POCO and Entity Framework v4. The layer supertype mainly deals with the common identity features of my entities, and has been designed for my POCO classes, but I am unsure how to map the object design to the database using edmx? ie Customer...