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

  • Home
  • SEARCH
  • 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 3675676
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:00:21+00:00 2026-05-19T03:00:21+00:00

As of version 2.1, NHibernate supports constructor injection for IUserTypes via IoC container (supplied

  • 0

As of version 2.1, NHibernate supports constructor injection for IUserTypes via IoC container (supplied through the ByteCodeProvider config setting).

However, when I try to get this working through Fluent NHibernate configuration (not auto mapping), when I build my configuration, I get an exception complaining that one of my objects (a custom ICompositeUserType, in this case) does not have an empty default constructor.

I traced this exception down to a call to Activator.CreateInstance() in FluentNHibernate.Mapping.PropertyPart.AddColumnsFromCompositeUserType(Type compositeUserType).

The whole point of NHibernate’s IoC support feature was to replace calls to Activator.CreateInstance with calls to the provided custom ByteCodeProvider.

So I guess my question is this: is it possible to get this working with Fluent NHibernate, or do I have to scrap my Fluent NH configuration and go back to NHibernate’s built-in programmatic configuration?

Links to blog posts about this feature:

  • NHibernate IoC integration
  • Autofac implementation

UPDATE: it looks like the problem is with FluentNHibernate’s handling of custom implementations of ICompositeUserType. I changed my Composite User Types to IUserType (which is probably better suited for what the classes actually were), and it looks like Fluent NHibernate is cooperating now.

UPDATE #2: Adding an empty constructor does solve the problem – I’d mark this as answered, but the suggestion came in a comment instead of an answer, so I’m upvoting those comments (until an official answer is added).

  • 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-19T03:00:21+00:00Added an answer on May 19, 2026 at 3:00 am

    Keep in mind that all Fluent NHibernate does is create the same configuration object structure that utilziing NHibernate XML would. How are you trying to set the ByteCodeProvider via Fluent NHibernate?

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

Sidebar

Related Questions

What is the last version of nhibernate that supports .Net Framework 2 ? and
So Hibernate Supports the latest Version of Firebird, which is really great. But... I
NHibernate Version: 2.1 I'm using what seems to be a pretty standard HttpModule approach
I am experimenting with NHibernate (version 2.1.0.4000) with Fluent NHibernate Automapping. My test set
considering the latest version of Entity framework as against NHibernate, is there a reason
I am using Hibernate 3 version for my Application . While going through tutorials
Does the current version of NHibernate (v2.1.2) support access Oracle stored procedure output REFCURSOR
In older version of NHibernate there was a method called AddUsedTypedValues in ICriteriaQuery. After
Can someone please help me understand the following: In the previous version of NHibernate
I am using NHibernate version 2.0.0.4000. In one of my queries I wanted to

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.