Make a Value type that many tables use

Posts   
 
    
Kevinksy
User
Posts: 27
Joined: 05-Jun-2013
# Posted on: 03-Sep-2013 18:47:35   

LLBL 4.0 Final Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production Database first Code Generation Visual Studio 2010 using C# Target Framework LLBL Gen Pro Runtime Framework Target language C#, platform .NET 4.0 Template Self Servicing Selected Preset SD.Presets.SelfServicing.General

I am updating a C# project built with LLBL 2.0. The original developer did not leave us with the LLBL project so I have to guess what to do based on the decompiled LLBL 2 source code.

In the original source code in a dll called <project name>.LLBL.Support.dll, v2.0.50727 is this code using System;

namespace SD.LLBLGen.Pro.ORMSupportClasses
{
    public interface IEntityDate
    {
        int CreatedByUserId { get; set; }
        DateTime DateCreated { get; set; }
        DateTime DateLastModified { get; set; }
        int LastModifiedByUserId { get; set; }
    }
}

These four fields are found in hundreds of tables in the schemas. How would I duplicate this in the new LLBL project?

I created a custom Value Type but am unsure what to do next. Is this a custom property or task to add this Value type to the tables that the fields with the Value type fields?

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Sep-2013 08:21:58   

Kevinksy wrote:

I created a custom Value Type but am unsure what to do next. Is this a custom property or task to add this Value type to the tables that the fields with the Value type fields?

You can use the same ValueType on different entities. You need to map them manually on each entity you want. You do that this way

  1. Edit the desired entity.
  2. Click the first field you need and change the type, set your currently valueType.
  3. Delete the remaining fields, the mapping of the value type is done automatically.
  4. Do the same with other entities.
David Elizondo | LLBLGen Support Team
Kevinksy
User
Posts: 27
Joined: 05-Jun-2013
# Posted on: 04-Sep-2013 14:04:01   

I have hundreds of tables that use this group of fields for auditing and concurrency. Is there a script or plug in that would work along the lines of (in pseudo code)

after create or refresh catalog
loop through all entities
for any entity that has the field date_created 
replace with the custom value type
delete the other three fields

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Sep-2013 19:14:33   

There is not, but maybe you can come up with a plugin that does so.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 05-Sep-2013 13:51:25   

A plugin can be triggered to run after a refresh, using the designer events so through a plugin this can be made set & forget. If you get stuck with writing the plugin let us know.

Frans Bouma | Lead developer LLBLGen Pro