Setting a list of audited fields at design time


Author
Message
Peter Denton
Peter Denton
StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)StrataFrame User (147 reputation)
Group: Forum Members
Posts: 77, Visits: 787
Andria,

I think I know why this doesn't work in the constructor of your base BO, and that is because in the designer for your end BO will be

Public Overrides ReadOnly Property AllFieldsList() ...

So your end BO will use this property correctly in code, but when the constructor for your base BO runs it will try to use its own AllFieldsList which will not have been instantiated.

I don't have any suggestions to get around the problem, but I hope an understanding of the problem might help you find a solution.

Peter


Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Just to also note, this approach DOES work in code.  It defaults so that all fields are audited, however I cannot get to the collection in the designer so that I can uncheck the fields which I don't want audited.
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
I have created a base business object which all of my BOs will inherit from.  This will handle among other thing, auditing user changes to data.  For each BO, I need to hold a list of AuditedFields so it know which fields it cares about changes on.  I have this working fine by using the same concept as the RequiredFields collection.  However, I would like for all fields to be checked by default instead of unchecked.  I have the following in the constructor of the base business object, which I thought would work:

If Me.AuditUserChanges And Me.AuditedFields.Count = 0 Then
 
For Each field As String In Me.AllFieldsList.ToArray
   
Dim AuditField As New RequiredField()
    AuditField.FieldType =
Me.FieldDbTypes(field)
    AuditField.FieldName = field
    AuditedFields.Add(AuditField)
 
Next
End If

So basically, I'm just saying if i'm auditing and haven't selected any fields to audit, go ahead and default to audit all of them by adding each field from the AllFieldsList to the AuditedFields collection.  The problem is that when I open any of the inherited BOs in the designer I get the following error message:

A class that inherits from MicroFour.StrataFrame.BusinessLayer must implement the AllFieldsList property.

Any idea what is going on here?  Am I just not using the AllFieldsList collection correctly here?  Is there a better way to accomplish what I'm trying to do?

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