Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

update documentation to show how to use fluent mapping #4484

Open
hahn-kev opened this issue Apr 17, 2024 · 1 comment
Open

update documentation to show how to use fluent mapping #4484

hahn-kev opened this issue Apr 17, 2024 · 1 comment

Comments

@hahn-kev
Copy link
Contributor

All the docs I found about fluent mapping look like this:

var myFluentMappings = new MappingSchema();
var builder       = mappingSchema.GetFluentMappingBuilder();

builder.Entity<Product>()
    .HasTableName("Products")
    .HasSchemaName("dbo")
    .HasIdentity(x => x.ProductID)
    .HasPrimaryKey(x => x.ProductID)
    .Ignore(x => x.SomeNonDbProperty)
    .Property(x => x.TimeStamp)
        .HasSkipOnInsert()
        .HasSkipOnUpdate()
    .Association(x => x.Vendor, x => x.VendorID, x => x.VendorID, canBeNull: false)
    ;

however there's no GetFluentMappingBuilder method defined anywhere in the whole code base, after looking around for a while I figured out that you're supposed to do this instead:

new FluentMappingBuilder(mappingSchema)
                    .HasAttribute<Commit>(new ColumnAttribute())
                    .Build();

docs should be updated to help people figure out what to do.

@AppChenX
Copy link

You can add the above code into the constructor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants