Passing different Entities as parameter to ViewModel constructor

2 posts, 0 answers
  1. jay
    jay avatar
    39 posts
    Member since:
    Jun 2010

    Posted 18 Jun 2011 Link to this post

    I have a ViewModel for an edit screen in a SL4 RIA Service solution that looks like this:

    public GenericEditViewModel (int intA, string strB, RIA_EntityA entityObj)
            {
                   ......
            }

     

     

    I am using this same viewmodel to edit several entities, such that the type of entityObj is not constant.
    How can I use the same ViewModel Constructor to handle calls for, say, RIA_EntityB, RIA_EntityC.......?
    I tried generics, but that did not seem to work?

    Thanks !

  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 19 Jun 2011 Link to this post

    Hello jay,

    I suggest asking such general .NET questions on a place like StackOverflow.

    Greetings,

    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top