This is a migrated thread and some comments may be shown as answers.

Fluent API - per-class configuration and context

3 Answers 66 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jc mag
Top achievements
Rank 1
jc mag asked on 01 Oct 2011, 11:28 PM
I was trying your per-class configuration example (http://www.telerik.com/help/openaccess-orm/fluent-mapping-integration-enhancer-per-class-configuration.html); and you said:
"The benefit in this case is that you are not obligated to create a class that derives from FluentMetadataSource and to override the abstract PrepareMapping method"

But then, how should I update my FluentContext class? If I have no MetadataSource class what should I pass in the constructor?

public class FluentContext : OpenAccessContext
    {
        //static MyFluentMetadataSource metadataSource = new MyFluentMetadataSource();
        static BackendConfiguration backendConfiguration = new BackendConfiguration()
        {
            Backend = "mssql"
        };
  
        private const string DbConnection = "ConnectionString";
  
        public FluentContext()
            : base(DbConnection, backendConfiguration, ??)
        {
  
        }

3 Answers, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 04 Oct 2011, 03:35 PM
Hello Jc Mag,

 Unfortunately this seems to be an error in the documentation, you still need to create and implement the abstract FluentMetadataSource. The PrepareMapping you have to override should just return an empty list. With this setup, during runtime the mapping will be collected from all of the classes having a static method that returns a MappingConfiguration

We will be updating the help topic immediately. Thank you for noticing this error. 

I hope this helps.

Kind regards,
Serge
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

0
bohebolo
Top achievements
Rank 1
answered on 20 Nov 2012, 12:12 PM
It seems the online documentation has not been updated yet.
I spent several hours only for this...


0
Ivailo
Telerik team
answered on 23 Nov 2012, 08:50 AM
Hi,

Thank you for pointing us to that omission and please accept our apologies for it. The article will be updated immediately and the fix will be live within two weeks. We have updated your Telerik Points for helping us out.  

Do not hesitate to get back to us if you find any other issues or you have questions regarding the usage of Fluent API.

All the best,
Ivailo
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Tags
General Discussions
Asked by
jc mag
Top achievements
Rank 1
Answers by
Serge
Telerik team
bohebolo
Top achievements
Rank 1
Ivailo
Telerik team
Share this question
or