I am trying to write a custom plugin that creates multiple tables on install. Everything works fine with one table and the code below. but if I try to do two tables I get an Ambiguous error message
Search the internet but can not find the solution. Any help would be appreciated.
This is the error message... The table names are unique
"Ambiguous match found."
" at System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)\r\n at System.Type.GetProperty(String name, BindingFlags bindingAttr)\r\n at System.SharedTypeExtensions.GetPropertiesInHierarchy(Type type, String name)+MoveNext()\r\n at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)\r\n at System.Reflection.PropertyInfoExtensions.FindSetterProperty(PropertyInfo propertyInfo)\r\n at System.Reflection.PropertyInfoExtensions.IsCandidateProperty(PropertyInfo propertyInfo, Boolean needsWrite, Boolean publicOnly)\r\n at Microsoft.EntityFrameworkCore.Metadata.Internal.MemberClassifier.FindCandidateNavigationPropertyType(PropertyInfo propertyInfo)\r\n at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.GetNavigationCandidates(EntityType entityType)\r\n at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.FindRelationshipCandidates(InternalEntityTypeBuilder entityTypeBuilder)\r\n at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.DiscoverRelationships(InternalEntityTypeBuilder entityTypeBuilder)\r\n at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)\r\n at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.RunVisitor.VisitOnEntityTypeAdded(OnEntityTypeAddedNode node)\r\n at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.VisitConventionScope(ConventionScope node)\r\n at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionBatch.Run()\r\n at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(TypeIdentity& type, ConfigurationSource configurationSource, Boolean throwOnQuery)\r\n at Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource, Boolean throwOnQuery)\r\n at Microsoft.EntityFrameworkCore.ModelBuilder.Entity[TEntity]()\r\n at Microsoft.EntityFrameworkCore.ModelBuilder.ApplyConfiguration[TEntity](IEntityTypeConfiguration`1 configuration)\r\n at Nop.Plugin.Fanolli.Journal.Data.FanolliJournalObjectContext.OnModelCreating(ModelBuilder modelBuilder)\r\n at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)\r\n at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)"
I am not sure if it is possible that way but I always create new DataObjectContext for each context. You will have 2 DataObjectContex File
//data context builder.RegisterPluginDataContext<Table1DataObjectContext>(CONTEXT1_NAME);//First One builder.RegisterPluginDataContext<Table2DataObjectContext>(CONTEXT2_NAME);//Second One
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.