Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Designer> FK/UC/PK name patterns. Missing something?
 

Pages: 1
Designer
FK/UC/PK name patterns. Missing something?
Page:1/1 

  Print all messages in this thread  
Poster Message
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 09-Jun-2014 16:20:26.  
Quite a lot of small, lovely improvements. Thanks.

I do not know if this is the expected result.
... or something is wrongly configured.

On northwind (already created ddbb & llblgen project)

1.
Code:
UC_{$TableName}_{$FieldNames}


Result (Create script)
Code:

-- Should be [UC_Shippers_CompanyName] ??
ALTER TABLE [dbo].[Shippers]
    ADD CONSTRAINT [UC_6647bca44879f2219c739e6c220] UNIQUE NONCLUSTERED
    (
        [CompanyName]
    )
GO

ALTER TABLE [dbo].[Suppliers]
    ADD CONSTRAINT [UC_d6cdae143d19d349c0d381ad7b6] UNIQUE NONCLUSTERED
    (
        [CompanyName], [ContactName]
    )
GO


2.
Code:
FK_{$TableName}_{$PkTableName}

Result (Create script):
Code:

-- Should be [FK_CustomerCustomerDemo_CustomerDemographics]
ALTER TABLE [dbo].[CustomerCustomerDemo]
    ADD CONSTRAINT [FK_CustomerCustomerDemo] FOREIGN KEY
    (
        [CustomerTypeID]
    )
    REFERENCES [dbo].[CustomerDemographics]
    (
        [CustomerTypeID]
    )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION
GO

-- OK
ALTER TABLE [dbo].[CustomerCustomerDemo]
    ADD CONSTRAINT [FK_CustomerCustomerDemo_Customers] FOREIGN KEY
    (
        [CustomerID]
    )
    REFERENCES [dbo].[Customers]
    (
        [CustomerID]
    )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION
GO


Best regards
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37803 posts
# Posted on: 09-Jun-2014 16:34:56.  
I'll look into it. I have to check whether a changed pattern will result in new names on existing elements in all cases.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37803 posts
# Posted on: 10-Jun-2014 11:15:53.  
Your post showed we missed some essential documentation: when are the patterns applied? They're not applied when you change them. The reason is that it would otherwise cause a lot of changes for existing projects which read an existing schema. (as the default is UC_{Guid})

The patterns are applied when a new UC/FK/PK is created, and when an element is renamed and 'Sync relational model data element name after rename' is set to true. So when you rename an entity and that setting is set to true, the table name is renamed and this triggers renames of FK constraints using the pattern.

We'll update the beta docs (and real docs of course Wink) with an updated section about this, as it's currently indeed confusing.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 10-Jun-2014 11:24:19.  
Good enough. It makes sense. Regular Smiley
Thanks.


  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.