Skip to content

领域模型没有设置主键时,会导致IShardingBootstrapper启动时报空引用错误 #128

@jjyangbiu

Description

@jjyangbiu

情形

构造了一个没有主键的领域模型

OnModelCreating内使用entity.HasNoKey()进行声明领域模型无主键

报错日志

 Application startup exception
   System.NullReferenceException: Object reference not set to an instance of an object.
   at ShardingCore.Bootstrapers.EntityMetadataInitializer`2.Initialize()
   at ShardingCore.Bootstrapers.ShardingDbContextBootstrapper`1.InitializeEntityMetadata()
   at ShardingCore.Bootstrapers.ShardingDbContextBootstrapper`1.Init()
   at ShardingCore.Bootstrapers.ShardingBootstrapper.Start()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions