调查AmbiguousMatchException

时间:2014-07-07 12:25:22

标签: c# entity-framework exception

我正试图找到一个AmbiguousMatchException的底部,我已经完成了代码审查,但它还没有发现任何有用的东西。

我认为这与此EF错误有关 - Can't map two classes with same name from different namespace并且已经进行了代码更改,这可能会导致自上次部署以来的问题。我试图将对象添加到实体,只是;

var request = new ApplicationRequest
{
   Name = "Test Application"
   // ... many more Properties
};
var context = new DataContext();
context.ApplicationRequests.Add(request);

挖掘返回的调试对象,但找不到任何链接到导致问题的实际类型或属性名称的内容。

Ambiguous Match Record Debugger

我的调用堆栈提供的信息很少;

Stack Trace

context.ApplicationRequests.Add(request);

之前在即时窗口中运行GetType
applicationRequest.GetType();
{Name = "ApplicationRequest" FullName = "EntityModel.ApplicationRequest"}
    [System.RuntimeType]: {Name = "ApplicationRequest" FullName = "EntityModel.ApplicationRequest"}
    base {System.Reflection.MemberInfo}: {Name = "ApplicationRequest" FullName = "EntityModel.ApplicationRequest"}
    Assembly: {EntityModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
    AssemblyQualifiedName: "EntityModel.ApplicationRequest, EntityModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
    Attributes: Public | BeforeFieldInit
    BaseType: {Name = "Object" FullName = "System.Object"}
    ContainsGenericParameters: false
    DeclaringMethod: 'applicationRequest.GetType().DeclaringMethod' threw an exception of type 'System.InvalidOperationException'
    DeclaringType: null
    FullName: "EntityModel.ApplicationRequest"
    GenericParameterAttributes: 'applicationRequest.GetType().GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException'
    GenericParameterPosition: 'applicationRequest.GetType().GenericParameterPosition' threw an exception of type 'System.InvalidOperationException'
    GenericTypeArguments: {System.Type[0]}
    GUID: {c48e0605-6d74-388d-b21d-2fb630b1220e}
    HasElementType: false
    IsAbstract: false
    IsAnsiClass: true
    IsArray: false
    IsAutoClass: false
    IsAutoLayout: true
    IsByRef: false
    IsClass: true
    IsCOMObject: false
    IsConstructedGenericType: false
    IsContextful: false
    IsEnum: false
    IsExplicitLayout: false
    IsGenericParameter: false
    IsGenericType: false
    IsGenericTypeDefinition: false
    IsImport: false
    IsInterface: false
    IsLayoutSequential: false
    IsMarshalByRef: false
    IsNested: false
    IsNestedAssembly: false
    IsNestedFamANDAssem: false
    IsNestedFamily: false
    IsNestedFamORAssem: false
    IsNestedPrivate: false
    IsNestedPublic: false
    IsNotPublic: false
    IsPointer: false
    IsPrimitive: false
    IsPublic: true
    IsSealed: false
    IsSecurityCritical: true
    IsSecuritySafeCritical: false
    IsSecurityTransparent: false
    IsSerializable: false
    IsSpecialName: false
    IsUnicodeClass: false
    IsValueType: false
    IsVisible: true
    MemberType: TypeInfo
    Module: {EntityModel.dll}
    Namespace: "EntityModel"
    ReflectedType: null
    StructLayoutAttribute: {System.Runtime.InteropServices.StructLayoutAttribute}
    TypeHandle: {System.RuntimeTypeHandle}
    TypeInitializer: null
    UnderlyingSystemType: {Name = "ApplicationRequest" FullName = "EntityModel.ApplicationRequest"}

0 个答案:

没有答案