Custom Key Generator always not found assembly
Posted: Thu 18 Jul 2013 03:16
I have little project with this scenario
1. I create CustomGenerator with name MemberIdGenerator extend from KeyGenerator
2. Entity class namespace and MemberIdGenerator namespace have same namespace (namespace: eCoMaxDB)
3. I set entity primary ke to CustomGenerator with Class Name:"eCoMaxDB.MemberIdGenerator" with single passing parameter
4. I have already set on model designer for custom generator, and generated class with primary key attribute like this
but the problem is, at runtime it always complain, "Can not load type 'eCoMaxDB.MemberIdGenerator' from assembly 'Devart.Data.Linq'
- is any specific requirement using custom generator?
- can I request sample project using custom generator?
1. I create CustomGenerator with name MemberIdGenerator extend from KeyGenerator
2. Entity class namespace and MemberIdGenerator namespace have same namespace (namespace: eCoMaxDB)
3. I set entity primary ke to CustomGenerator with Class Name:"eCoMaxDB.MemberIdGenerator" with single passing parameter
4. I have already set on model designer for custom generator, and generated class with primary key attribute like this
Code: Select all
[Column(Storage = "_MemberId", CanBeNull = false, DbType = "VARCHAR(50) NOT NULL IDENTITY", IsPrimaryKey = true)]
[Devart.Data.Linq.Mapping.CustomGenerator(ClassName = "eCoMaxDB.MemberIdGenerator", Parameters = new object[] { URI })]
Code: Select all
System.TypeLoadException was unhandled
HResult=-2146233054
Message=Could not load type 'MemberIdGenerator' from assembly 'Devart.Data.Linq, Version=4.2.272.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.
Source=mscorlib
TypeName=MemberIdGenerator
StackTrace:
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at Devart.Data.Linq.Mapping.CustomMetaKeyGenerator.a(DataContext A_0, MetaDataMember A_1)
at Devart.Data.Linq.Engine.x.a(MetaDataMember A_0)
at Devart.Data.Linq.Engine.h.a(IKeyGeneratorManager A_0)
at Devart.Data.Linq.Engine.b6.a(IObjectEntry[] A_0, ConflictMode A_1, a A_2)
at Devart.Data.Linq.Engine.b6.a(ConflictMode A_0)
at Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at eCoMaxDBManager.MemberManager.Save(MemberData data) in F:\My Document\Visual Studio 2010\Projects\eCoMaxDotNetSQLServer\eCoMaxDB\MemberManager.cs:line 42
at TestConsole.Program.Main(String[] args) in F:\My Document\Visual Studio 2010\Projects\eCoMaxDotNetSQLServer\TestConsole\Program.cs:line 50
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
- can I request sample project using custom generator?