Wilson ORM and embedded mapping files

From the notes to self department on Wilson ORM:

If you want to embed your mapping file resource in an assembly and then retrieve it to pass to an ObjectSpace you need to use code similar to the following:

ObjectSpace meetingsSpace = null;
Assembly assembly = Assembly.GetAssembly(typeof(Meeting));
using (Stream mappingStream = assembly.GetManifestResourceStream("Meetings.Mappings.config"))
{
    string connectionString = ConfigurationManager.ConnectionStrings["Meetings"].ConnectionString;

    meetingsSpace = new ObjectSpace(mappingStream, connectionString, Provider.MsSql);
}

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s