Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange Error
Message
 
 
General information
Forum:
ASP.NET
Category:
Entity Framework
Title:
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01608756
Message ID:
01608780
Views:
28
How should I load the source libraries?

The error is thrown on this line

_dbSet.Attach(entity); // Error here



>I'd be *very* surprised if this was case related.
>
>Since the exception is thrown by Type.GetProperty() when it cannot uniquely identify a property based on the supplied parameters then seeing the class definition for the EntityEntry involved would be helpful.
>
>IAC, I'd suggest loading the source libraries so that you can step into the process and discover what the 'name' parameter is when Type.GetProperty() throws the exception.
>
>>Update. http://forums.asp.net/t/1775469.aspx?System+Reflection+AmbiguousMatchException+Ambiguous+match+found+
>>
>>
>>Re: System.Reflection.AmbiguousMatchException: Ambiguous match found.
>>Aug 02, 2012 12:16 PM|LINK
>>
>>I had a similar issue: I am using POCO object with Entity Framework 4, and I got the same exception when adding a new object with 'AddObject'.
>>
>>The problem in my case was that an entity had two members with the same name and different casing. One was a field from the database, and one was a navigation property. Just renaming one of the two solved the problem.
>>
>>This sounds like my issue but the classes are auto-generated :( What should I do?
>>
>>---------------------------------------------
>>Hi everybody,
>>
>>I am getting the following error:
>>
>>System.Reflection.AmbiguousMatchException was unhandled by user code
>> HResult=-2147475171
>> Message=Ambiguous match found.
>> Source=mscorlib
>> StackTrace:
>> at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
>> at System.Type.GetProperty(String name, BindingFlags bindingAttr)
>> at System.Linq.Expressions.Expression.PropertyOrField(Expression expression, String propertyOrFieldName)
>> at System.Data.Entity.Core.Objects.Internal.EntityProxyFactory.CreateBaseGetter(Type declaringType, PropertyInfo propertyInfo)
>> at System.Data.Entity.Core.Objects.Internal.PocoPropertyAccessorStrategy.GetNavigationPropertyValue(RelatedEnd relatedEnd)
>> at System.Data.Entity.Core.Objects.Internal.EntityWrapper`1.GetNavigationPropertyValue(RelatedEnd relatedEnd)
>> at System.Data.Entity.Core.Objects.EntityEntry.TakeSnapshotOfRelationships()
>> at System.Data.Entity.Core.Objects.Internal.EntityWrapperWithoutRelationships`1.TakeSnapshotOfRelationships(EntityEntry entry)
>>etc.
>>
>>on this line of code:
>>
>>
>> public virtual void Update(T entity)
>>        {
>>            EntityState entityState =  _siriusContext.GetEntityState(entity) ;
>>            if (entityState == EntityState.Detached)
>>            {
>>                _dbSet.Attach(entity); // Error here
>>            }
>>
>>
>>Do you know what this may be about? The table has character 10 primary key but I'm not sure if this is relevant or not. I haven't gotten this error before.
>>
>>Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform