We considered that, however in MS SQL, ALTER TABLE ? NOCHECK
CONSTRAINT disables the foreign key for inserts/updates, but not for
replication.. In order to disable a foreign key for replication you
actually have to drop and re-create it. Also only NHibernate-created
tables need to be fixed, so I cannot use EXEC sp_msforeachtable.

On Aug 5, 9:18 am, Francois Ward <[email protected]> wrote:
> Why not just disable them afterward?
>
> Something like EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
>
> On Wed, Aug 4, 2010 at 5:48 PM, Jason Dentler <[email protected]>wrote:
>
>
>
> > You can probably create a custom dialect to do this. I'm not sure if
> > there's an easier way.
>
> > On Wed, Aug 4, 2010 at 11:29 AM, v64 <[email protected]> wrote:
>
> >> Hi,
>
> >> I'm generating the database schema (for MS SQL Server) from a mapping
> >> file through Configuration.GenerateSchemaUpdateScript() and would like
> >> to create foreign keys with no enforcement.
>
> >> The reason I don't want the database to enforce the foreign keys is
> >> that on a large database they impair OLTP performance and concurrency.
> >> We have application level mechanisms to ensure data consistency and
> >> don't need the database to do it.
>
> >> On the other hand, I would like to have the (unenforced) foreign key
> >> constraints in the database for the benefit of report designers and
> >> diagraming tools which use foreign keys to display table
> >> relationships.
>
> >> So is it possible to have NHibernate generate unenforced foreign key
> >> constraints?
>
> >> TIA
> >> v
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "nhusers" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]<nhusers%[email protected]­>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/nhusers?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected]­>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to