Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NewEntity creates duplicate entities
Message
From
10/05/2007 14:16:09
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
NewEntity creates duplicate entities
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01224306
Message ID:
01224306
Views:
63
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
Next
Reply
Map
View

Click here to load this message in the networking platform