Results 1 to 3 of 3

Thread: How to implement a List of Diffrent Generic Lists

  1. #1

    Thread Starter
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    How to implement a List of Diffrent Generic Lists

    I want to create a Object thet reports all data collisions and it needs to return lists of (diffrent objects) that collide with each other.

    The first step was to create a generic interface holding a list(OF T)
    like so:

    Code:
    Public Interface IValidationResult(Of T)
    
        ReadOnly Property ResultList() As IList(Of T)
        ReadOnly Property ResultCount() As Integer
    
    End Interface
    These lists should be added to a object to hold all colliding issues in seperate Lists... and that's Where I get stuck this code goes wrong because a specification of the Type of IValidationResult like:
    IValidationResult(Of Persons)
    is needed but I want to add diffrent Hardtyped lists to the object like
    A list of Conflicting PersonData:
    IValidationResult(Of Persons)
    A list of conflicting Securityroles
    IValidationResult(Of SecurityRoles)
    A list of Conflicting SaldoItems
    A list ofIValidationResult(Of SaldoItems)


    Code:
    Public Interface IValidationResults
    
        ReadOnly Property IsValid() As Boolean
        ReadOnly Property ResultLists() As IList(Of IValidationResult)
        ReadOnly Property ResultListsCount() As Integer
        ReadOnly Property ResultCount(ByVal ListIndex As Integer) As Integer
        Sub AddList(ByVal ValidationResult As IValidationResult)
    
    End Interface
    How to achieve this goal with strong typed lists wich can be refered so in the code using this error reporting?

    Thanks in Advance
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to implement a List of Diffrent Generic Lists

    I, for one, don't really understand what you're asking.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    Re: How to implement a List of Diffrent Generic Lists

    Goal:
    you have severalkind of datacollisions that can occur if you add a piece of data to a Webbased database.
    You want to resolve these collisionsin the userinterface.

    To do so I came up with a principal solution that was like this:
    The dataprovider returns an object called ValidationVioaltionResults with a list of Objects called ValidationVioaltionResult (<- No s at the end)

    The ValidationVioaltionResult (<- No s at the end) contains:
    - A message Decribing the kind of collision that occured
    - A list with
    1 the item you want to add
    and all items that collided with for this type of collision

    The colliding objects can be of diffrent Types. So a generic List needs to be placed in the The ValidationVioaltionResult.List (<- No s at the end)

    The challenge I need to adress is either:
    -how can I do this without losing the type Store the Type of the list(of T)
    in a propperty so i can cast it back to the correct Type in the userinterface
    Or
    -retreive the Type of this list again so I can Cast The List(Of T)
    back into a List(Of Person) for instance.
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width