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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:32:59+00:00 2026-06-17T14:32:59+00:00

Im on a legacy system where triggers are abundant in the database. Therefore I

  • 0

Im on a legacy system where triggers are abundant in the database.

Therefore I have an entity mapped in Fluent NHB on which I would like to enforce that only updates and selects can be performed, as there is a trigger on another table which performs the inserts into this table.

In short i want to ensure that it iss not possible to do inserts with this entity.

Something along the line .Not.Insert(), but for the entity and not a column.

Note: Triggers are often a bad choice for stuff like this, but due to the complexity i do not have the option to delete the trigger just yet.

Can this be done with Fluent NHB?

  • 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-17T14:33:00+00:00Added an answer on June 17, 2026 at 2:33 pm

    I don’t think there is a simple (“designed”) way to do it, but I can think of the following potential options:

    Custom IEntityPersister (IClassPersister). Derive from the default persister, then override the Insert() methods to throw NotSupportedException. Must be configured in the mapping (not sure if this step can be done through FluentNH):
    http://nhibernate.info/doc/nh/en/index.html#mapping-declaration-class

    Or implement a suitable NHibernate event listener that can detect INSERT statements for a number of tables, and prevent these by throwing.

    Or make your domain classes have private/protected setters for the Id property, then use the mapping to tell NHibernate that the “assigned” id generator should be used. NHibernate can now not INSERT such objects unless the application sets the Id, which should never happen since it’s protected (sort of…).

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

Sidebar

Related Questions

We have a legacy system that requires a format which is not html but
I am connecting to a legacy rdbms system using System.Data.OdbcClient. I would like to
I have a legacy system which can create files visible in WebDav as an
In a legacy system we have a database that saves non existent relations with
I have a legacy system that I'd like to extend with an application written
I have a legacy system which uses a set of robots, (automated processes), to
I have a table from a legacy system which does not have a primary
I have A Legacy system that runs on a SQL Server 2005. Current table
I have legacy system where all date fields are maintained in YMD format. Example:
We have a legacy system that is essentially a glorified telnet interface. We cannot

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.