Hi,
I think you are mixing several things there.
Fields are embedded accross 3 types of objects:
First you've got the properties generated by LLBLGen in the concrete classes:
That's what you're trying to access when using:
Dim enumItem As FieldInfo = enumType.GetField(sFieldName)
In your sample, you're getting a reference to the "CategoryId" property, of type Integer I guess.
Now if you look what's inside the getter, you'll see there's no _CategoryId private member as you may expect but instead it accesses an element of a collection of type EntityFields2, thus an item of type EntityField2, which is some kind of LLBLGen descriptor for your columns.
It exposes various information though several properties, combining the format of the targetted column (this is actually split into a dbgeneric (IEntityCore) and a dbspecific (IFieldPersistenceInfo) side) and also the value and state of that field in the current entity/typedview the field belongs to.
Now in other terms, yourCategory.CategoryId is a shortcut for yourCategory.Fields["CategoryId"].CurrentValue
And finally, in order to ease various accesses to the fields, some Enumeration were generated for each entity/view: the fields are enumerated with their names and integer values as their order of their use in corresponding EntityFields collection.
AlphabeticalListOfProductsFieldIndex.CategoryId is an example.
So once again that is 3 different types and you have:
yourCategory.CategoryId ~ yourCategory.Fields["CategoryId"].CurrentValue = yourCategory.Fields[0].CurrentValue = yourCategory.Fields[(int) AlphabeticalListOfProductsFieldIndex.CategoryId].CurrentValue
Now, as for the use of those 3 faces of the same data, their are several ways leading to the same path.
The generated predicate factories take enums values as inputs, because they call EntityFields factories to produce the EntityFields from their enums but you may also use the EntityFields directly.
PredicateFactory.CompareValue(AlphabeticalListOfProductsFieldIndex.CategoryId, ComparisonOperator.Equal, 2)
is the same as:
(FieldCompareByValuePredicate) (AlphabeticalListOfProductsFields.CategoryId = 2)
Here, AlphabeticalListOfProductsFields.CategoryId is not the enum but rather a property of an helper class providing a shortcut to the EntityField factory.
That said you have to correct the mix between:
System.Reflection.FieldInfo extracted by reflection from the corresponding CategoryId AlphabeticalListOfProductsTypedView property
SD.LLBLGen.Pro.ORMSupportClasses.EntityField2 that you can obtain from
EntityFieldFactory.Create(AlphabeticalListOfProductsFieldIndex.CategoryId)
or equivalently AlphabeticalListOfProductsFields.CategoryId
or also yourCategory.Fields["CategoryId"]
and finally the enum AlphabeticalListOfProductsFieldIndex.CategoryId
Hope that makes it clearer
Cheers