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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:12:04+00:00 2026-05-13T06:12:04+00:00

I recently asked a question about using Fluent NHibernate with .NET 4 – I

  • 0

I recently asked a question about using Fluent NHibernate with .NET 4 – I solved that problem, but met a new one.

Summary
My main problem (at the moment) is configuring the database. I’m following this guide, but trying to work against SQL Server 2008 Express instead, as that’s what I’ll be using and thus what I need to learn.

The failing code:

public static ISessionFactory CreateSessionFactory()
{
    return Fluently.Configure()
        .Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("mssql")))
        .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>())
        .ExposeConfiguration(cfg => new SchemaExport(cfg).Create(true, true))
        .BuildSessionFactory();
}

When I try to run my application, I get the following exception on the last line (.BuildSessionFactory()):

Inheritance security rules violated while overriding member: ‘FluentNHibernate.Cfg.FluentConfigurationException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)’. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

What is causing this?

  • 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-13T06:12:05+00:00Added an answer on May 13, 2026 at 6:12 am

    From the Microsoft Connect issue:

    Security attributes need to be
    re-applied on types that derive from
    other types that also have security
    attributes.

    Maybe FluentConfigurationException needs to apply a [SecurityPermission] attribute to its GetObjectData() method.

    Else check out this blog post.

    EDIT: The final solution was adding [SecurityCritical] to FluentConfigurationException.GetObjectData()

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

Sidebar

Related Questions

I recently asked a question about the same function, that solved my probelem and
I recently asked a question about committing a new file but now I am
Note: I originally asked this question about an hour ago but only recently realized
So recently, I asked a question about a class I created that extended SQLiteOpenHelper
I recently asked a question about using the Page.User or HttpContext.Current.User in the View.
I recently asked a question about functional programming, and received (good!) answers that prompted
I recently asked just about the same question, but this one got a little
I recently asked a question about tracing Linq-to-Entities I think that one of the
I recently asked a question about IIf vs. If and found out that there
I recently asked a question about using XSL/t for creating a site layout 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.