Enum DB relationships


Author
Message
Vikram Saxena
Vikram Saxena
StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)
Group: Forum Members
Posts: 41, Visits: 99
I have following tables

CustomerTable - customerId, Name, City, StatusId, TypeId

StatusTable - statusId, status

TypeTable - TypeId, Type

Now, how can i create Enum in CustomerBO to handle these 2 fields [StatusId,TypeId] and also bind the dropdowns in Customer webform with the complete list of Status & Types.

Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Just create two enumerations and then associate them with the field in the BO Mapper.  For example, let's take your StatusID field. 

Step 1
Public Enum StatusTypes As Integer
    Active = 0
    Inactive = 1
End Enum

(Generally when I am associating enums with BO fields, I will create the enums in the same assembly and namespace as the BOs themselves).

Step 2
Now open the BO Mapper and navigate to the field you wish to associate with the enum.  Select the field and then click "Customize" and then set the Custom Data Type setting:

Click OK...and be sure to rebuild your partial class for the change to take affect.

Step 3
Go to your form where you want to populate a combo with an enum.  Select the combo and go to the property sheet to setup the enum population:


Vikram Saxena
Vikram Saxena
StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)
Group: Forum Members
Posts: 41, Visits: 99
Hello Trent,

The main catch here is that the enums [or list of master entries] is generated from the database as i have written in initial case and not really coded as ENUM in the code.

how to handle the db related cases without making too many parent-Child relationship?

Vikram

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You cannot have a dynamic enum...enums are static.  So I assume you want to populate a combo from a business object and then bind to a foreign key.  First, you will want to populate the combo using a business object:  I am just going to point you to the help since it says a lot more than I can in this post: UI Layer -> Controls -> List Population

As for your parent-child relationships, look in the help under: Business Layer -> Common Business Object Tasks -> Defining a relationship between business objects

If this doesn't get you going let me know.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search