On the latest 5.2 version, trying to add concurrency to Timestamp fields...
Dotnet v4.6.2, working with LLBLGen framework and SQL Server.
So I add the bottom code to my DatabaseGeneric project, which has worked in the past, then I add to App.config
<appSettings>
<add key="autoDependencyInjectionDiscovery" value="true"/>
</appSettings>
Executing the application gives the following error:
System.IO.FileLoadException: 'Could not load file or assembly 'Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
This is raised by one of my Entity classes, in the call
/// <summary> Initializes the class members</summary>
private void InitClassMembers()
{
PerformDependencyInjection(); <======
// __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
// __LLBLGENPRO_USER_CODE_REGION_END
OnInitClassMembersComplete();
}
Any suggestions?
Cheers,
Jason
using SD.LLBLGen.Pro.ORMSupportClasses;
namespace SMS.DB
{
[DependencyInjectionInfo(typeof(IEntity2), "ConcurrencyPredicateFactoryToUse",
ContextType = DependencyInjectionContextType.NewInstancePerTarget)]
public class TimestampConcurrency : IConcurrencyPredicateFactory
{
public IPredicateExpression CreatePredicate(ConcurrencyPredicateType predicateTypeToCreate,
object containingEntity)
{
IPredicateExpression toReturn = new PredicateExpression();
IEntity2 entity = (IEntity2)containingEntity;
var tsfield = entity.Fields["Timestamp"];
if (tsfield != null)
{
switch (predicateTypeToCreate)
{
case ConcurrencyPredicateType.Delete:
toReturn.Add((EntityField2)tsfield == entity.Fields[tsfield.FieldIndex].DbValue);
break;
case ConcurrencyPredicateType.Save: // only for updates
toReturn.Add((EntityField2)tsfield == entity.Fields[tsfield.FieldIndex].DbValue);
break;
}
}
return toReturn;
}
}
}