Sorry I couldn't get back to the thread right away. Here is what I am doing in my application.
I have a BL class defined as follows (partial code):
[ Serializable ]
public class Organization : OrganizationEntity
{
public Organization() : base(new PropertyDescriptorFactory(), new OrganizationEntityFactory())
{
this.ConcurrencyPredicateFactoryToUse = new OrganizationConcurrencyFilterFactory();
}
The ConcurrencyPredicateFactoryToUse is set each time it's instaniatied.
In my web form I have the following:
private void pbSave_Click(object sender, EventArgs e)
{
try
{
//Create a new org object
org = new InClinixBL.Organization();
//Set key fields and IsNew flag
orgID = (int)ViewState["OrgID"];
org.Fields["OrgID"].ForcedCurrentValueWrite(orgID);
org.Fields["Version"].ForcedCurrentValueWrite(ViewState["Version"] as byte[]);
org.IsNew = false;
//Unload data fields into org object
org.OrgName = txtOrgName.Text;
org.AutoAccrual = rblAccrualMethod.SelectedValue;
org.HideNames = rblHideNames.SelectedValue;
//Save to database
if (org.Save())
{
MessageBox1.Text = "Organization was saved.";
}
else
{
MessageBox1.Text = "Organization was NOT saved.";
}
}
catch (Exception ex)
{
Util.PublishError(ex, "Error saving Organization", true, true);
}
}
I get the following error everytime I save. I have not gotten to the point of testing when another session has modified the row.
12/15/2004 4:01:55 PM (bshuman2: ImClone1)
An exception was caught during the execution of an action query: Prepared statement '(@OrgName varchar(50),@AutoAccrual char(1),@HideNames char(1),@O' expects parameter @Version2, which was not supplied.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
Stack Trace:
at SD.LLBLGen.Pro.ORMSupportClasses.ActionQuery.Execute()
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.ExecuteActionQuery(IActionQuery queryToExecute, ITransaction containingTransaction)
at InClinixDAL.DaoClasses.OrganizationDAO.CreateAndRunUpdateQuery(IEntityFields fields, ITransaction containingTransaction, IPredicate updateFilter) in C:\Vault\InClinix v3\Code\Application\InClinixDAL\DaoClasses\OrganizationDAO.cs:line 768
at InClinixDAL.DaoClasses.OrganizationDAO.UpdateOrganization(IEntityFields fields, ITransaction containingTransaction, IPredicate updateRestriction) in C:\Vault\InClinix v3\Code\Application\InClinixDAL\DaoClasses\OrganizationDAO.cs:line 127
at InClinixDAL.EntityClasses.OrganizationEntityBase.UpdateEntity(IPredicate updateRestriction) in C:\Vault\InClinix v3\Code\Application\InClinixDAL\EntityBaseClasses\OrganizationEntityBase.cs:line 2162
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase.Save(IPredicate updateRestriction, Boolean recurse)
at InClinixDAL.EntityClasses.OrganizationEntityBase.Save(IPredicate updateRestriction, Boolean recurse) in C:\Vault\InClinix v3\Code\Application\InClinixDAL\EntityBaseClasses\OrganizationEntityBase.cs:line 352
at InClinixBL.Organization.Save(IPredicate updateRestriction, Boolean recurse) in c:\vault\inclinix v3\code\application\inclinixbl\organization.cs:line 115
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase.Save()
at InClinix.Organization.pbSave_Click(Object sender, EventArgs e) in c:\vault\inclinix v3\code\application\demo\inclinixv3demo\organization.aspx.cs:line 155
Sorry for the long post. Thanks for looking at this.
-Bill Shuman