Hey everyone,
This has probably been addressed many times before through the forum but I had no such luck pinpointing my exact problem. Currently, I am to the point where I have generated the data access code and exercised it through a data access layer. I am able to create an entity and store it in the database (although it takes a little while 10-20 seconds per entity save). My issue is that when I take the entity and turn it back into a object, the properties that were on the entity are out of sync and cannot be accessed.
The code exercising the save and return:
public IFormType AddFormType(string name, string desc, IFormType parent)
{
// check if it exists
LinqMetaData metaData = new LinqMetaData(_dataAdapter);
var entity = metaData.Formtype.FirstOrDefault(a => a.Name == name && a.Parentformtypeid == (parent == null ? -1 : GetDBType(parent).FormTypeID));
if (entity != null)
{
return EntityToObject(entity);
}
lock (LockObject)
{
long parentID = parent ==null?-1:GetDBType(parent).FormTypeID;
FormtypeEntity fte = new FormtypeEntity
{
Name = name,
Description = desc,
Parentformtypeid = parentID
};
bool succesfulInsert = _dataAdapter.SaveEntity(fte, true);
return EntityToObject(fte);
}
}
I have double checked my sequences and messed with the connection strings as far as timeout issues but have not found any solution. I am also having trouble accessing the source code for the SaveEntity() function so I can understand what exactly is going on. Any assistance would be much appreciated and thank you for your time.