nhibernate / fluent-nhibernate

Fluent NHibernate!
BSD 3-Clause "New" or "Revised" License
1.66k stars 686 forks source link

Annotations extensions #635

Closed zhoupan closed 9 months ago

zhoupan commented 9 months ago

1.Upgrade FluentNHibernate.csproj, set TargetFrameworks to net6.0. when compile using VS 2022 , the ide complain that , so I let ide upgrade the project. net6.0 not required Reference System.ComponentModel.Annotations.

  1. FluentNHibernateAnnotationsExtensions.cs Set ColumnMapping.NotNull when [Required] present or not GetType().IsNullable(). Set ColumnMapping.Length when [MaxLength] present. Configure GeneratorMapping.Class to [assinged] when [DatabaseGenerated(DatabaseGeneratedOption.None)] present. Configure GeneratorMapping.Class to [identity] when [DatabaseGenerated(DatabaseGeneratedOption.Identity)] present.

3.Update DefaultAutomappingConfiguration.cs. IsId: return true when [Key] present on member.

4.Update IdentityStep.cs. Support [DatabaseGenerated(DatabaseGeneratedOption.None)]
Support [DatabaseGenerated(DatabaseGeneratedOption.Identity)]

5.Update PropertyStep.cs. Support [MaxLength], [Required], or GetType().IsNullable().