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

Allow mapping via fluent API #165

Open
cremor opened this issue Jun 6, 2024 · 6 comments
Open

Allow mapping via fluent API #165

cremor opened this issue Jun 6, 2024 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@cremor
Copy link

cremor commented Jun 6, 2024

It would be great if this library could also provide fluent mapping APIs to allow mapping of check constraints without using attributes.

Example:
There is no HasMinLength() fluent mapping method. So you have to use a [StringLength(2, MinimumLength = 2)] attribute to get a min length check constraints.

@roji
Copy link
Member

roji commented Jun 6, 2024

@cremor the point of this plugin is to provide support for standard .NET plugins which are already there - [StringLength] is part of .NET. If you just want to specify a minimum length check constraint in EF via the Fluent API, you can simply define the check constraint directly via EF's API (docs).

@cremor
Copy link
Author

cremor commented Jun 7, 2024

Yes, but with manually written check constraints I also have to manually do all the work that this library is already doing when I use attributes, like:

  • building the constraint name
  • using the correct column name
  • correctly quoting the column name

I like that this library does all that automatically 😄

@roji
Copy link
Member

roji commented Jun 7, 2024

I'll leave this open in the backlog, but all the above really is trivial stuff - this plugin really was meant for making the built-in .NET attributes work, not making a really simple task even a big simpler :)

@roji roji added this to the Backlog milestone Jun 7, 2024
@roji roji added the enhancement New feature or request label Jun 7, 2024
@martin-hirsch

This comment was marked as resolved.

@roji

This comment was marked as resolved.

@martin-hirsch

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants