Validation


Author
Message
Lenard Dean
Lenard Dean
StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)
Group: Forum Members
Posts: 7, Visits: 25
Hi,

When checking for broken rules, how does one check the DB field's type & size of a mapped BO "field"?  I would like to limit the user's entry to what the actual DB field will allow.  Or what are others doing? 

--Lenard

Gary Wynne
Gary Wynne
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 10, Visits: 40
Hi Lenard

There is no totally straightforward answer that I know of. However, if you look in the BOMapper generated code of the business object in question, there are many collections of table related metadata that you could use to obtain schema information to compare against entered data.

HTH

-=Gary

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Howdy, Lenard,

There are static (shared) collections that contain the database types and field lengths for the business objects.  Each business object class has it's own set of collections.  Being static, you cannot access them through the "this" (or Me) reference, you have to use the ClassName.Collection notation.

If you look in one of the .designer.* files for your business objects and go to the static constructor for the class, you'll find where the collections are populated the first time a business object of that type is created.

AllFieldsList -- A List<string> containing all of the fields in the business object
FieldDbTypes -- A Dictionary<string, System.Data.DbType> containing the DbTypes of all of the fields on the business object
FieldEnums -- A dictionary containing the enum values that represent each field.  You can also obtain the values by using Enum.Parse(), but it's faster to pull them from a dictionary
FieldLengths -- A Dictionary<string, int> containing the lengths of the fields
FieldNativeDbTypes -- A Dictionary<string, int> containing the native DbType enum values for the business object.  If the BO was mapped to a SQL database, then the values will be System.Data.SqlDbType and can be cast accordingly.  System.Data.OracleClient.OracleType for an Oracle BO, System.Data.OleDb.OleDbType for OLE DB, etc.

Hopefully that will help.

Lenard Dean
Lenard Dean
StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)
Group: Forum Members
Posts: 7, Visits: 25
Thanks Ben and Gary.

In the application I'm planning to rewrite using StrataFrame, I have a global static class with properties which return a regular expression formula and associated tooltip for each user field.  The downside to this method is the need to update the class everytime changes are made the db schema. 

Anyways, I thought I'd try something a little different this time around knowing now that Strataframe exposes what I need easily.

--Lenard

P.S.  When I download the trial version, I didn't see any API help file.  Is it only available when one purchases StrataFrame?

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