entity

Entity validation with different scenario

On the assumption that I have Entity with couple of fields. Some fields are required at some specific state but others only on further/other state. public class Entity { //Required always public SomeReference {} //Required in specific situation/scenario public OtherReference {} } How to achieve that scenario with som...

How I can Update the row ionto database using ADo.net Data Entity Model

How I can Update the row ionto database using ADo.net Data Entity Model ...

Using a stored procedure in entity framework, how do I get the the entity to have its navigation properties populated?

Hi, Entity framework is cripplingly slow so i tried using a stored procedure but i ran into this problem.. Entity Framework allows you to define a stored procedure that produces an entity. However my entity has 'navigation properties' which are not being populated when using this method. Is there a work around? Thanks ...

Merging XML files using external entities in Visual Studio 2008

I have some xml data contained in three files (Database.xml, Participants.xml, and ConditionTokens.xml). I am trying to use external entities to place the participants and condition tokens into the database file, but when I run this code... string xmlPath = Environment.CurrentDirectory + @"\Data\Database.xml"; XElement database = XEleme...

How Do You Prevent A javax Transformer From Escaping Whitespace?

I'm using the javax.xml.transform.Transformer class to perform some XSLT translations, like so: TransformerFactory factory = TransformerFactory.newInstance(); StreamSource source = new StreamSource(TRANSFORMER_PATH); Transformer transformer = factory.newTransformer(source); StringWriter extractionWriter = new StringWriter(); String xml ...

How to use non-key composite elements in EJB3?

Using EJB3/JBoss, how can I use a composite element from a table, e.g. @Entity public class X { @Id private int id; private Coordinate coordinate; } where Coordinate is a defined as (setters/getters left out for readability): public class Coordinate { int x; int y; } And everything should be mapped to Table X which...

Multiple Versions of SQL Server using Entity Framework in a single ASP.NET application

I am using the Entity Framework in a web application that utilizes SQL server 2000, 2005, and 2008. When I create a new EDMX file using anything other than 2008 (version of the first edmx created) I receive error 0172: All SSDL artifacts must target the same provider. The Provider 'MyDatabase' is different from ' MyDatabase ' that was en...

Entity Framework: perform a query on a linking table / many to many relationship

I am trying to perform a query using linq to entities to that an entity/table doesn't contain the same values before I update it. The structure of the database is as follows: Users User_IPAddresses IPAddresses ----- ---------------- ----------- UserID >------ UserID ------< IPAddr...

Entity Framework - Update entity with child properties.

I have an entity that has one child and I need to update it, but, in the TryUpdateModel method, it does not accept an strong typed object (accepts only a FormCollection), and when I try to update it, I get the following error. {"A relationship is being added or deleted from an AssociationSet 'FK__SG_Usuari__ID_Si__534D60F1'. With cardi...

How do you build your LINQ queries?

It seems there are two ways to build queries -- either using query expressions: IEnumerable<Customer> result = from customer in customers where customer.FirstName == "Donna" select customer; or using extension methods: IEnumerable<Customer> result = ...

Best practice for EJB remote interface wrapping entitys

I currently have the excercise at university to create several Java-entitys (Person, Employee, Department, DepartmentType, ...) handled by JPA which should be accessed by the client through some EJBs (I think that's best practice?!). Now I think about how to organize/design the EJBs. Do you create one EJB per Entity? Or one EJB for all...

Using sharp architecture and subclassing entity

I've been trying to use #harp architecture and Fluent-NHibernate. I am trying to sublass off of SharpArch.Core.DomainModel.Entity since I have some entities in my domain model that must have a unique name. public abstract class UniqueNamedEntity : Entity { protected UniqueNamedEntity() { } protected UniqueNamedEntity(stri...

How to change the Entity EJB mapping in RAD back-ends folder.

We are maintaining a J2EE enterprise application that uses EJB Entity beans and we use IBM Rational Application Developer as development platform. The application currently has a few Entity beans so a corresponding back-ends folder has already been created by somebody and is available. Oracle 9i was used for creating the back-end folder...

How to make Entity Framework cache some objects

I'm using Entity Framework. In my database are stored persons and country of their origins. When I'm loading a person object I wan't to know what is the place each person originates. Is there a way to cache list of countries so that there wouldn't be unnecessary requests. ...

attaching an entity with a related entity to a new entity framework context

Im trying to get my head around attaching an entity with a related entity to a new context when I want to update the entity. I have a Person Table (Generalised to Personnel), which has a LanguageID field. This field is linked as a FK via the EF to another table Language with LanguageID as the primary key (1-M). I need to update a partic...

Entity Framework - Join on many to many

I have a simple many to many relationship and I am wondering how you get data out of it. Here is the setup Tables Media Media_Keyword (many to many map) Keyword Here is the code I have: public List<Keyword> GetFromMedia(int mediaID) { var media = (from m in Connection.Data.Media where m.id == media...

Entity Framework Metadata LINQ (Converting from C# to VB.NET)

I've got a query in C# that is working for me to query the metadata for the Entity Framework. I need to convert it to VB.NET, but I'm struggling to convert the AS keyword to "cast" meta to System.Data.Metadata.Edm.EntityType. I've tried TryCast, CType, Cast, etc. Here's the query in C#: var queryResult = from meta in oc.MetadataWorks...

Entity Framework - SaveChanges() doesn't get the generated Identity key

I'm using entities Framework in my project and it has been a nightmare! I have a SQL DB were I have a table called Form. Form has an ID that is a PK and Identity (it's automatically increased). This time I'm doing this: Dim form as int32 Dim dbform As New Entities1 Dim form696 As New Form dbform.AddToForm696(form) dbform.SaveChanges...

DTD Entities vs XML-Schema Elements

Hi, using an in Document DTD I did the following: file.xsl: <!DOCTYPE xsl:stylesheet[ <!ENTITY red "rgb(255,0,0)"> ]> <xsl:stylesheet> [...] <xsl:attribute name="color">&red;</xsl:attribute> [...] </xsl:stylesheet> I wanted to change everything to XML-Schema. So I tried: file.xsd: <xsd:schema xmlns:xsd="http://www.w3.o...

Binding for an EntitySet is displaying values that aren't there?

I'm binding an ItemsControl to an EntitySet in a WPF application. Its not acting as expected, however. The ItemsControl is behaving as if it is caching the contents of the EntitySet between binds! Here's the stripped down code: The entity: public partial class Item : INotifyPropertyChanging, INotifyPropertyChanged { private Enti...