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

merging MappingConfiguration from many assemblies?

1 Answer 39 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MATEUSZ
Top achievements
Rank 1
MATEUSZ asked on 14 Oct 2011, 02:11 PM
Hi.
I'm trying to a achieve some specific behaviour and it turned out not to be so easy.

Let's say that i in Core project i have:
public class Car : IEntity
    {
        public virtual int Id { get; set; }
        public static MappingConfiguration<Car> CreateConfiguration()
        {
            var userMapping = new MappingConfiguration<Car>();
            userMapping.MapType(u => new
            {
                Id = u.Id,
            }).ToTable("Car");
            userMapping.HasProperty(u => u.Id).IsIdentity(KeyGenerator.Autoinc);
 
            return userMapping;
        }
    }
 
and
 
public class MyFluentMetadataSource : FluentMetadataSource
    {
        protected override IList<MappingConfiguration> PrepareMapping()
        {
            return new List<MappingConfiguration>();
        }
    }

I have a Test project too. When I want to use entities and metadatasource from Core project, everything works fine.
Problem start when I want to palce some test entities and place them in Test project.
I started from creating TestMetadataSource in Test project and enhacing it. However, either core or test entities configuration was acquired, but never simultaneously.

So how should TestMetadataSource be implemented to acquire mapping configurations from both projects?

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivailo
Telerik team
answered on 18 Oct 2011, 02:17 PM
Hello Mateusz,

In order to achieve that, you will have to merge the two MetadataSources to produce a new MetadataContainer holding both mappings and definitions. You can do that automatically through our AggregateMetadataSource class, as shown in the linked help article.

I hope that this will answer your question. In any case, do not hesitate to contact us for further clarification or assistance.


Best wishes,
Ivailo
the Telerik team

Check out the latest stable build of Telerik OpenAccess ORM. Download it and benefit from our new Project Templates.

Tags
Getting Started
Asked by
MATEUSZ
Top achievements
Rank 1
Answers by
Ivailo
Telerik team
Share this question
or