Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NewEntity creates duplicate entities
Message
De
10/05/2007 14:16:09
Danny Green
Aptitude Solutions
Floride, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
NewEntity creates duplicate entities
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01224306
Message ID:
01224306
Vues:
66
In version 2.4 using the NewEntity function seems to create 2 Entities. I looked at the source code:


public virtual EntityType NewEntity(object defaultValues)
{
DataRow Row = this.NewRow(defaultValues);

And then in NewRow:

public override DataRow NewRow(System.Data.DataSet ds, string tableName, object defaultValues)
{
DataRow Row = base.NewRow(ds, tableName, defaultValues);

if (tableName == this.TableName)
{
if (EntityList != null)
{
EntityType EntityObject = this.CreateEntityObject();
EntityObject.SetDataRow(Row);
this.EntityList.Add(EntityObject);
}
}

return Row;
}

Which creates an entity object and adds it to the list. But then continued in NewEntity:

public virtual EntityType NewEntity(object defaultValues)
{
DataRow Row = this.NewRow(defaultValues);
EntityType EntityObject = this.CreateEntityObject();
EntityObject.SetDataRow(Row);
if (EntityList != null)
{
this.EntityList.Add(EntityObject);
}
return EntityObject;


Am I correct that there is a bug, or am I doing something wrong?

Thanks!
Danny
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform