Hi
I just noticed something that, IMHO, should be a public read only property in all the Entity classes genereated by LLGen. All the classes shold have a public readonly property that reaturns the Entity class name. This is to catch and avoid errors in project code code written using the entity class methods that need the enity name as string. Take for example the following scenario (based on a true life story )
Consider the following code:
Private Sub DeleteInActiveUsers(ByVal blInActive as Boolean)
Dim adapter as New DataAdapter
Dim bucket As New RelationPredicateBucket
Dim ExpA As IPredicateExpression = New PredicateExpression
ExpA.Add(PredicateFactory.CompareValue( _
UserFieldIndex.IsActive, ComparisonOperator.Equal, blInActive))
bucket.PredicateExpression.Add(ExpA)
'Delete all items that match criteria
adapter.DeleteEntitiesDirectly("UserInfoEntity", bucket)
End Sub
The above code works like a charm, that is until the you change your database and end up deleting the "UserInfoEntity" entity. (Hey - I know that it's good practice to have a well designed database BEFORE coding, but in app development it's almost impossible not to have to make some table changes along the way, especially if you have a finicky client)
In any case, the above code, after deleting the "UserInfoEntity", remains unaffected, UNTIL you go and try and execute it. It of course, throws an error because the "UserInfoEntity" no longer exists. In the advanced stages of app development finding stuff like this can be rather difficult and easy to overlook.
However, if the Entity Classes had a public readonly property that returns the name of the entity, for example "Public readonly property EntityName as String", the above code would have looked like this:
....(Same)...
'Delete all items that match criteria
adapter.DeleteEntitiesDirectly(UserInfoEntity.EntityName, bucket)
As soon as "UserInfoEntity" was removed, this would throw a build error and be caught right away. Since it's always good practice to never hard code strings into code, not only would this catch any buld errors it just makes good programming sense....
Steve