Omnia9
Omnia9

Reputation: 1573

Automapper : Automating Profile registration not using global.aspx

I am using AutoMapper in a distributable C# DLL for my ORM logic.

This DLL is consumed by different development teams for the web projects. Some of these web projects are MVC and some are web forms.

If there a way to have my DLL ensure that all the mappings have been register on application-start without having each team put the calls in their global files?

I have profiles all setup, but want this step to be hidden and always done.

Thanks

Upvotes: 1

Views: 147

Answers (1)

boca
boca

Reputation: 2352

The only thing I can think of is to have a static constructor for a class in your dll where you will initialize automapper.

public class MyOrmClass
{
     public static MyOrmclass()
     {
         //initialize automapper
     }
}

I have an open source library that might help you with it, but you might have to do some small changes on each client

Upvotes: 1

Related Questions