I have more information that may help (sorry Im new to this LLBL stuff)
I am trying to build a set of objects that hide the LLBL entities from my presentation layer, and at the moment I am working on a user entity that will become the users of my application... once I get this one right then I will work on the others.
This idea is that I create a class User that subsequently passes all requests on to the LLBL UserEntity class therefore I get the code
public class User
{
private UserEntity mEntity;
public User()
{
mEntity = new UserEntity();
}
public User(int id)
{
DataAccessAdapter myAdapter = new DataAccessAdapter("..ConnectionString..");
mEntity = new UserEntity(id);
myAdapter.FetchEntity(mEntity);
}
}
I then have a whole load of properties that relate to the individual fields
public int UserID
{
get{return mEntity.UserID;}
set{mEntity.UserID = value;}
}
... etc
however when I run the code
MyBusinesObject.User myUser = new MyBusinessObject.User(1);
Console.Writeline(myUser.UserID.ToString());
I get the error
"The entity is out of sync with the data in the database. Refetch the entity before using the in-memory instance"
I am obviously doing something utterly stupid but I cant see what... any ideas?
Thanks in advance