Glass Mapper SitecoreService를 사용하여 항목을 가져 오는 데 문제가 있습니다. 항목이 올바르게 존재하고 유형이 정확합니다. (그것은 TDS에 의해 생성됩니다).Sitecore Glass Mapper : "어셈블리 내에 중복 된 형식 이름"오류
var language = Language.Parse("en-GB");
var service = new SitecoreService("master");
var targetPath = String.Format("{0}-migrated", Constants.SourceProviderListPageItem);
var target = service.GetItem<IProvider_List_Page>(targetPath, language);
위 코드 service.GetItem <T>가 호출되는 다음과 같은 예외가 발생.
Duplicate type name within an assembly.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Duplicate type name within an assembly.
[ArgumentException: Duplicate type name within an assembly.]
System.Reflection.Emit.ModuleBuilder.CheckTypeNameConflict(String strTypeName, Type enclosingType) +14373369
System.Reflection.Emit.AssemblyBuilderData.CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType) +91
System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, ModuleBuilder module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType) +161
System.Reflection.Emit.ModuleBuilder.DefineType(String name, TypeAttributes attr) +263
Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope modulescope, String name, Type baseType, IEnumerable`1 interfaces, TypeAttributes flags, Boolean forceUnsigned) +156
Castle.DynamicProxy.Generators.InvocationTypeGenerator.GetEmitter(ClassEmitter class, Type[] interfaces, INamingScope namingScope, MethodInfo methodInfo) +239
Castle.DynamicProxy.Generators.InvocationTypeGenerator.Generate(ClassEmitter class, ProxyGenerationOptions options, INamingScope namingScope) +124
Castle.DynamicProxy.Contributors.InterfaceProxyWithoutTargetContributor.GetInvocationType(MetaMethod method, ClassEmitter emitter, ProxyGenerationOptions options) +430
Castle.DynamicProxy.Contributors.InterfaceProxyWithoutTargetContributor.GetMethodGenerator(MetaMethod method, ClassEmitter class, ProxyGenerationOptions options, OverrideMethodDelegate overrideMethod) +100
Castle.DynamicProxy.Contributors.CompositeTypeContributor.ImplementMethod(MetaMethod method, ClassEmitter class, ProxyGenerationOptions options, OverrideMethodDelegate overrideMethod) +69
Castle.DynamicProxy.Contributors.CompositeTypeContributor.ImplementProperty(ClassEmitter emitter, MetaProperty property, ProxyGenerationOptions options) +128
Castle.DynamicProxy.Contributors.CompositeTypeContributor.Generate(ClassEmitter class, ProxyGenerationOptions options) +306
Castle.DynamicProxy.Generators.InterfaceProxyWithoutTargetGenerator.GenerateType(String typeName, Type proxyTargetType, Type[] interfaces, INamingScope namingScope) +499
Castle.DynamicProxy.Generators.<>c__DisplayClass1.<GenerateCode>b__0(String n, INamingScope s) +38
Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType(CacheKey cacheKey, Func`3 factory) +757
Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, IInterceptor[] interceptors) +159
Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type interfaceToProxy, IInterceptor interceptor) +129
Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateInterface.CreateInterfaceTask.Execute(ObjectConstructionArgs args) +381
Glass.Mapper.Pipelines.AbstractPipelineRunner`2.Run(T args) +616
Glass.Mapper.AbstractService.InstantiateObject(AbstractTypeCreationContext abstractTypeCreationContext) +646
Glass.Mapper.Sc.SitecoreService.CreateType(Type type, Item item, Boolean isLazy, Boolean inferType, Dictionary`2 parameters, Object[] constructorParameters) +721
Glass.Mapper.Sc.SitecoreService.CreateType(Item item, Boolean isLazy, Boolean inferType) +215
Glass.Mapper.Sc.SitecoreService.GetItem(String path, Language language, Boolean isLazy, Boolean inferType) +239
<Redacted>.Page_Load(Object sender, EventArgs e) +584
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
어떤 문제일까요?
건배
전체 스택 추적을 가지고 있습니까? –
안녕하세요, Michael 님, 도와 주셔서 감사합니다. 요청한대로 스택 추적을 추가했습니다. –
[Interface as Model] (http://glass.lu/Mapper/Sc/Tutorials/Tutorial21.aspx)을 사용하는 것 같습니다. TDS를 사용하고 있으므로 구체적인 클래스도 생성됩니다. 대신'Provider_List_Page'를 사용해보십시오. 내 생각 엔 인터페이스와 콘크리트의 존재가 여기에 문제를 일으키는 것 같지만 @MichaelEdwards가 확인할 수있을 것입니다 ... – jammykam