Using Attribs v.s. Fluent API

5 posts, 0 answers
  1. Von
    Von avatar
    13 posts
    Member since:
    Aug 2009

    Posted 06 Aug 2010 Link to this post

    Hello,

    Now that there is a Fluent Mapping API, what is the best recommended approach in creating persistent classes? When I first started using OpenAccess I used to decorate my class properties with attributes such as the "FieldAlias". I have watched the video on Getting Started with OpenAccess Fluent Mapping API and it seems like the better way of doing things. Is it just a matter of preference or is there any solid advantage to it.

    Thanks in advance!

  2. Serge
    Admin
    Serge avatar
    375 posts

    Posted 09 Aug 2010 Link to this post

    Hi Von,

     First of all I should point out that the Fluent Mapping API is still in a beta phase, even though we plan on releasing a stable version in the next service pack. The point I want to make however is that decorating you classes with attributes is a bit troublesome. Also this approach, known as Forward mapping is something we will not be putting effort into. 

    At the time we are dedicating our time and resources to the new domain model as well as the fluent mapping API. This means that the new features and improvement will only come in the fluent mapping. 

    This being said, the forward mapping is stable and the fluent mapping is in beta, and currently it does not support inheritance scenarios, even though this will soon be included in the product. 

    Please have in mind that my previous statements are given assuming that you were talking about the old attributes(FieldAlias, Persistent etc..). However we do have a new attributes mapping approach with completely new attributes that are being generated if you select "Attributes Mapping" in the Visual Designer. You could use those attributes for forward mapping as well. You could see more information on the matter in the following section of our documentation.

    It is up to you to decide what approach you will be using. Hope this helps.

    All the best,
    Serge
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Von
    Von avatar
    13 posts
    Member since:
    Aug 2009

    Posted 11 Aug 2010 Link to this post

    Hi Serge,

    I understand that Fluent API is still on the beta stage but thanks for reminding me. When you said releasing "in the next service pack" would that be on Q3 2010 release? That is also cool to spend your time to developing the Fluent API, personally I find it more appealing. It's easier to use and more intuitive, it just makes more sense to do the mapping that way. Although I admit I always use attribs-based mapping with the other ORM tools I used. So, if I continue using attributes and then later on use the Fluent API, would it mess my project later on? Do I need to clear the attributes off my classes? Do you have more  (I understand if not, since it's on beta) info on the Fluent API besides the provided video? Forgive me for all the questions as I am starting a new project and would like to know much to change, if there are any, with the new Fluent API.

    Thanks,
    Von
  5. Serge
    Admin
    Serge avatar
    375 posts

    Posted 12 Aug 2010 Link to this post

    Hi Von,

     By the next service pack I meant SP1 of the Q2 release and not the Q3 release. I would not encourage you to convert a model created with Forward mapping to use the Fluent Mapping, however it is possible and should you ask we will assist you in doing so.

    You will then need to clear off the attributes from your classes and further more change the entry point to OpenAccess. By that I mean you will have to convert the code using scope to use the context approach. This may sound like a complicated task but it actually isn't.  

    For more info on the fluent mapping you can have a look at our online help.

    I do hope this helps.

    Regards,
    Serge
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Von
    Von avatar
    13 posts
    Member since:
    Aug 2009

    Posted 12 Aug 2010 Link to this post

    Hi Serge,

    That makes sense about SP1 :)

    Thanks for all your inputs! I guess I can wait then for Fluent API as it will be out soon maybe in less than 3 months :)

    Regards,
    Von
Back to Top
DevCraft banner