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 791923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:54:47+00:00 2026-05-14T21:54:47+00:00

I have a c# library project, that i configured using nhibernate, and I like

  • 0

I have a c# library project, that i configured using nhibernate, and I like people to be able to import this project and use the project. This project has FrontController that does all the work.

I have a connection string in hibernate config file and in app.config file of another project.

it would be nice for anyone to be able to set the connection string into this library project and use it. such as through a method which will take the connectiong string as parameter. or when creating a new instance of FrontController to pass the connection string to constructor. or if you have a better idea.

How to do this?

I d like this class library to use the same database of the project that s imported.

How to set hibernate connection string programatically?

same idea for log4net.

  • 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-05-14T21:54:48+00:00Added an answer on May 14, 2026 at 9:54 pm

    It depends on how you build your NHibernate.Cfg.Configuration and session factory. It can be as simple as this:

    public ISessionFactory BuildSessionFactory(string connectionString) {
        var cfg = new Configuration()
                    .AddProperties(new Dictionary<string, string> {
                        {Environment.ConnectionDriver, typeof (SQLite20Driver).FullName},
                        {Environment.ProxyFactoryFactoryClass, typeof (ProxyFactoryFactory).AssemblyQualifiedName},
                        {Environment.Dialect, typeof (SQLiteDialect).FullName},
                        {Environment.ConnectionProvider, typeof (DriverConnectionProvider).FullName},
                        {Environment.ConnectionString, connectionString},
                    })
                    .AddAssembly(Assembly.GetExecutingAssembly());
        return cfg.BuildSessionFactory();
    }
    

    I’m not sure what you want to do with log4net though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Library Project that we use for all our central reused code
Good day, I have a library project that i use to create a paid
I have a Silverlght library project that produces a dll output. This project utilises
I have a maven project that has a set of library dependancies that are
I have a class library project that references the version 4.1 Microsoft.Practices.Common dll. I
I have a class, which is part of a code library project that was
I have a project that uses the Enterprise Library 4.1. When I target .net
We have a project that contains a library of Python and Scala packages, as
Let's say I have a project that is a class library. I have a
I have a Visual Studio 2008 C++ project that outputs a static library and

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.