Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8725565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:04:05+00:00 2026-06-13T08:04:05+00:00

Just a quick Q, Is the Fluent API is replaceable for Data Annotations in

  • 0

Just a quick Q, Is the Fluent API is replaceable for Data Annotations in term of features?
What the features in Data Annotations that is not included in Fluent API?

I want to use Fluent API because of Separation of Concern (between my model & persistence), convention over configuration (mapping defined in one place DbContext.OnModelCreating() but not at every model property) and I want to use VS 2010 Layer Validation to make sure my POCO classes will never have dependencies to EF, but what I miss if I totally remove Data Annotation from my source?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:04:06+00:00Added an answer on June 13, 2026 at 8:04 am

    I wanted to know this is because I want my POCO class totally isolated from EF (my repository and UoW pattern make kt possible to move to NHibernate).

    Fluent API > Data Annotations, that is Fluent API has more features than Data Annotations and useful to map table and create relationships. However Fluent API does not have nice label and validation for @Html.LabelFor and @Html.EditorFor by using [Display(Name:=...)], [DisplayFormat(DataFormatString=...)] and [Required(ErrorMessage=...)]. This is what making me headache.

    Now found the idea that:

    1. Uses Fluent API in Data layer so my model really POCO class (POCO project) and the dll can be use in WCF and other project which will subscribe to this service.

    2. Uses Data Annotation for ViewModel. Since this is only within UI layer and ViewModel never shared to other project except for MVC View, I dont mind to have Data Annotation attributes.

    3. Redo the constrain created in (1) into (2) like [Required] and [MaxLength]. I found some people said it is worth to repeat and volatile the DRY principle since ViewModel and domain model should be separated and does not related to each other even though I think MaxLength is some how related (just a small repeat and it should be ok for n-tier architecture + I can use static class and const to make the length the same for both side).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to do a quick poll to see if Fluent Nhibernate is
Just a quick question and I hope that hasn't been asked before. I want
Just a quick simple question that I can not seem to find an answer
Just a quick architecture question really on storing calendar data. Basically, I have a
Just a quick question. I have an NSArray that is generated in my applicationDidFinishLaunching
Just a quick question, I'm getting the idea that you don't. Why is this,
Just a quick check really. I have an XML file that I will be
Just a quick question, where do I put the exe that I am trying
Just a quick question. I understand that Singleton patterns can be extended and that
Just a quick question. Which one of the following makes a better Rest API

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.