長年のリスナー、初めての発信者 (ついにここでアカウントを作成しました!)...
Visual Studio 2013を.NET 4.5.1およびEntity Framework 6 (RC またはベータ版ではなく最終リリース)と共に使用しています。
DbGeography プロパティをエンティティに追加しようとすると、実行時に次のエラーが発生します。
One or more validation errors were detected during model generation:
Geocoder.DbGeography: : EntityType 'DbGeography' has no key defined.
Define the key for this EntityType.
DbGeographies: EntityType: EntitySet 'DbGeographies' is based on type 'DbGeography' that has no keys defined.
古いバージョンの Entity Framework への参照がないことを確認済みです (ここで説明します)。これは、.NET (さらに言えば SQL Server) の空間型への私の最初の進出であるため、例/情報としてこの投稿とこの MSDN の記事を使用してきました。
ここに私のエンティティがあります:
public class Location
{
public int Id { get; set; }
public string Name { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string City { get; set; }
public virtual State State { get; private set; }
public string ZipCode { get; set; }
public string ZipCodePlus4 { get; set; }
public DbGeography Geocode { get; set; }
public Hours Hours { get; set; }
public virtual ICollection<Language> Languages { get; private set; }
public virtual OfficeType OfficeType { get; private set; }
[JsonIgnore]
public virtual ICollection<ProviderLocation> Providers { get; private set; }
}
私は何を間違っていますか?