Skip to content

Annotations extensions #636

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

zhoupan
Copy link

@zhoupan zhoupan commented Jan 28, 2024

1.Upgrade FluentNHibernate.csproj, Add TargetFrameworks net6.0.
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().

1.GetDefaultGenerator: Try apply DatabaseGeneratedAttribute.
2.Map: Try apply RequiredAttribute, MaxLengthAttribute.
Map: Try apply RequiredAttribute, MaxLengthAttribute.
Upgrade <TargetFrameworks>net6.0</TargetFrameworks>
IsId: return true when [Key] present on member.
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<ItemGroup>
<PackageReference Include="NHibernate" Version="5.3.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I don't think I can accept this as a dependency.

{
private static INHibernateLogger Log { get; set; }

private static void UsingLog(Action<INHibernateLogger> log)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be completely unrelated to the proposed changes

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants