Coldairarrow / EFCore.Sharding

Database Sharding For EFCore
Apache License 2.0
694 stars 143 forks source link

不能用联合主键吗? #60

Closed maikebing closed 3 years ago

maikebing commented 3 years ago

不能用联合主键吗? 明明定义了 modelBuilder.Entity<TelemetryData>().HasKey(c => new { c.DeviceId, c.KeyName, c.DateTime }); 但没有效果。

An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: The entity type 'TelemetryData' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'.

Coldairarrow commented 3 years ago

image 你这代码放哪的?不是IEntityTypeConfiguration把

maikebing commented 3 years ago

不是

maikebing commented 3 years ago

我似乎搞清楚了点。

Coldairarrow commented 3 years ago

image 要类似这种用法

maikebing commented 3 years ago

感谢。 搞定了