Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:25:02+00:00 2026-06-16T00:25:02+00:00

I usually have no problem ‘seeding’ my database via NHibernate like this: … string[]

  • 0

I usually have no problem ‘seeding’ my database via NHibernate like this:

...
string[] mappingAssemblies = new string[] { "Bla.Di.Domain" };
string configFile = "NHibernate.config";
NHibernate.Cfg.Configuration config = NHibernateSession.Init(
    new SimpleSessionStorage(),
    mappingAssemblies,
    new AutoPersistenceModelGenerator().Generate(),
    configFile);

TextWriter writeFile = new StreamWriter("d:/SeedSQL.sql");

var session = NHibernateSession.GetDefaultSessionFactory().OpenSession();
new SchemaExport(config).Execute(true, true, false, session.Connection, writeFile);

For some reason the database is not created for the above dll (Bla.Di.Domain) with a simple class like this:

namespace Bla.Di.Domain
{
    using SharpArch.Domain.DomainModel;

    public class Test : Entity
    {
        public virtual string X { get; set; }
    }
}

Is there anything that could have gone potentially go wrong? I do not get an exception. I referenced the dll in my ‘seeding’ project. Maybe there is an issue with the file location of my dll (it is a fairly complicated solution). Thanks.

PS (as requested in comment):

This is my AutoPersistenceModelGenerator – please note that it lives in another namespace:

public class AutoPersistenceModelGenerator : IAutoPersistenceModelGenerator
{
    public AutoPersistenceModel Generate()
    {
        //var mappings = AutoMap.AssemblyOf<Bla>(new AutomappingConfiguration());
        var mappings = AutoMap.AssemblyOf<Test>(new AutomappingConfiguration());
        mappings.IgnoreBase<Entity>();
        mappings.IgnoreBase(typeof(EntityWithTypedId<>));
        mappings.Conventions.Setup(GetConventions());
        mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();

        return mappings;
    }

    private static Action<IConventionFinder> GetConventions()
    {
        return c =>
           {
               c.Add<PrimaryKeyConvention>();
               c.Add<CustomForeignKeyConvention>();
               c.Add<HasManyConvention>();
               c.Add<TableNameConvention>();
           };
    }
}

I have added a reference to the domain model (different name space) and changed:

var mappings = AutoMap.AssemblyOf<Bla>(new AutomappingConfiguration());

to:

var mappings = AutoMap.AssemblyOf<Test>(new AutomappingConfiguration());
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:25:03+00:00Added an answer on June 16, 2026 at 12:25 am

    Let us say we have two namespaces: CompanyName.X and CompanyName.Y.

    CompanyName.X contains class A and CompanyName.Y contains B, where A and B inherit from Entity. Then this adaptation helps:

    Original:

    public class AutoPersistenceModelGenerator : IAutoPersistenceModelGenerator
    {
        public AutoPersistenceModel Generate()
        {
            var mappings = AutoMap.AssemblyOf<A>(new AutomappingConfiguration());
            mappings.IgnoreBase<Entity>();
            mappings.IgnoreBase(typeof(EntityWithTypedId<>));
            mappings.Conventions.Setup(GetConventions());
            mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();
    
            return mappings;
        }
        ...
    

    Adapted code:

    public class AutoPersistenceModelGenerator : IAutoPersistenceModelGenerator
    {
        public AutoPersistenceModel Generate()
        {
            var mappings = AutoMap.AssemblyOf<A>(new AutomappingConfiguration());
            mappings.AddEntityAssembly(typeof(CompanyName.Y.B).Assembly);
            mappings.IgnoreBase<Entity>();
            mappings.IgnoreBase(typeof(EntityWithTypedId<>));
            mappings.Conventions.Setup(GetConventions());
            mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();
    
            return mappings;
        }
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When performing many inserts into a database I would usually have code like this:
I usually have my structure laid out something like this: <div id=all> <div id=page>
I'm new in this whole Android environment and I usually have some doubts that
I have small problem with prepare table. Generally I usually prepare this table in
I have a little databinding-problem. (I usually have...) This is the error I get
Interesting problem I have here, usually I just round up/down respectively for my needs
I usually have to check things like: if ['Bob','Mary','John'].include? @user.name Is there a way
In a Python system for which I develop, we usually have this module structure.
I'm working on a c# service application and i have this problem where out
I have a problem with the Mootools get method and IE8. This is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.