Hello!
I have extended the OrganizationUnit entity. But when i try to relate this extension with another entity, i get an error in migration like "Nullable object must have a value". Other relations is working good, but as soon as i include the extended entity, it fails. This although worked in Core 1.0.
System.InvalidOperationException: Objekt som kan ha värdet null måste ha ett värde.
vid System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
vid Microsoft.EntityFrameworkCore.Metadata.Internal.InternalEntityTypeBuilder.DetachRelationship(ForeignKey foreignKey)
vid Microsoft.EntityFrameworkCore.Metadata.Internal.InternalEntityTypeBuilder.HasBaseType(EntityType baseEntityType, ConfigurationSource configurationSource)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.DerivedTypeDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.RunVisitor.VisitOnEntityTypeAdded(OnEntityTypeAddedNode node)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAddedNode.Accept(ConventionVisitor visitor)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.Visit(ConventionNode node)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.VisitConventionScope(ConventionScope node)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionScope.Accept(ConventionVisitor visitor)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.Visit(ConventionNode node)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.VisitConventionScope(ConventionScope node)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionBatch.Run()
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionBatch.Dispose()
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.DiscoverRelationships(InternalEntityTypeBuilder entityTypeBuilder)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
vid Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
vid Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(EntityType entityType)
vid Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(Type type, ConfigurationSource configurationSource)
vid Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(TypeIdentity type, ConfigurationSource configurationSource)
vid Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
vid Microsoft.EntityFrameworkCore.ModelBuilder.Entity(Type type)
vid Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.FindSets(ModelBuilder modelBuilder, DbContext context)
vid Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelCustomizer.FindSets(ModelBuilder modelBuilder, DbContext context)
vid Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context)
vid Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
vid Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.<>c__DisplayClass5_0.<GetModel>b__0(Object k)
vid System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
vid Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
vid Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
vid Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
vid Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_1(IServiceProvider p)
vid Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider)
vid Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
vid Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
vid Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
vid Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
vid Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
vid Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
vid Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
vid Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider)
vid Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
vid Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
vid Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
vid Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
vid Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
vid Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance()
vid Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure`1 accessor)
vid Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(Func`1 factory)
vid Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
vid Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
vid Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
vid Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigration.<>c__DisplayClass0_1.<.ctor>b__0()
vid Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
vid Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Hello!
How can i do to show the name of current organizationUnit in the top of the page. Extending the "TenantName/UserName"-info that is prebuilt. I know that a user by default can be part of multiple organizations, but lets just pull out the first one.
Thanks in advance!
Hi!
I have extended the OrganizationUnit entity with a couple of properties. But i also would like to relate this entity to another one by both one-to-one and one-to-many relationship. Is this possible? I have this extendend class:
public class ExOu : OrganizationUnit
{
public virtual string Adress { get; set; }
public virtual string Email { get; set; }
public virtual string Phone { get; set; }
public virtual Setting Setting { get; set; }
public virtual ICollection<Customer> Customers { get; set; }
}
public class Setting : FullAuditedEntity<long>
{
public virtual bool UseSetting1 { get; set; }
public virtual bool UseSetting2 { get; set; }
public virtual long OrganizationUnitId { get; set; }
[ForeignKey("OrganizationUnitId")] // Doesn´t work
public virtual ExOu as ExOu { get; set; }
}
public class Customer : FullAuditedEntity<long>
{
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
public virtual long OrganizationUnitId { get; set; }
[ForeignKey("OrganizationUnitId")] // This Doesn´t work
public virtual ExOu ExOu { get; set; }
}
Hello!
I´m trying to extend the OrganizationUnit the same way it is explained on this page: <a class="postlink" href="https://www.aspnetzero.com/Documents/Extending-Existing-Entities#extending-non-abstract-entities">https://www.aspnetzero.com/Documents/Ex ... t-entities</a>
Like this:
using Abp.Organizations;
namespace Company.MyApp.OrganizationUnits
{
public class MyOrganizationUnit : OrganizationUnit
{
public virtual string Phone1 { get; set; }
}
}
But when i run the Add-migration, no changes are made. The migration is empty.