Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6107811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:13:44+00:00 2026-05-23T14:13:44+00:00

in my application I am wanting to make my interfaces more generic. As it

  • 0

in my application I am wanting to make my interfaces more generic. As it stands I have Two Models, CampaignModel and StringModel, these both use the same methods but with different arguments in them i.e.

CampaignModel:

void GetAll(EventHandler<GetAllCampaignsCompletedEventArgs> eh);
void GetAllByName(string name, EventHandler<GetCampaignCompletedEventArgs> eh);
void GetAllByID(long id, EventHandler<GetAllCampaignsByIDCompletedEventArgs> eh);
void Add(Campaign entity, EventHandler<CreateCampaignCompletedEventArgs> eh);
void Update(Campaign entity, EventHandler<UpdateCampaignCompletedEventArgs> eh);
void Delete(Campaign entity, EventHandler<DeleteCampaignCompletedEventArgs> eh);

StringsModel:

void GetAll(EventHandler<GetAllCampaignStringsCompletedEventArgs> eh);
void GetAllByName(string name, EventHandler<GetCampaignStringByIdentifierCompletedEventArgs> eh);
void GetAllByID(long id, EventHandler<EventArgs> eh);
void Add(CampString entity, EventHandler<EventArgs> eh);
void Update(CampString entity, EventHandler<EventArgs> eh);
void Delete(CampString entity, EventHandler<EventArgs> eh);

I am just needing direction as to how to create a more generic interface that I can use. The reason for this is I only want one set of Views for each Models .i.e only one Add,Update and Delete view that will call the methods from either the Campaign Model or the Strings Model. If you have any ideas how to get this done I would appreciate it.

Thanks,
Stuart.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:13:45+00:00Added an answer on May 23, 2026 at 2:13 pm

    If you look at the code you can see that, at least in the functions you provided, what changes between two clases is a type of paremeters. The common approach here is to define a Base type for every common group, so here is pseudocode:

    public class GetCampaignCompletedEventArgs : BaseEventArg {} 
    public class GetCampaignStringByIdentifierCompletedEventArgs: BaseEventArg {} 
    ... 
    ...
    public class Campaign : BaseCampaign {} 
    public class CampString: BaseCampaign {} 
    

    After this defin Interface or AbstractClass

    public interface IBase {
    void GetAllByName(string name, EventHandler<BaseEventArg > eh);
    ...
    

    }

    Just to give yuor idea, its difficult to me write somethign really concrete , cause its depends on yuor implementaiton.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wanting to incorporate HTML5 database storage into my web application to make it
I am wanting to expose some data service endpoints for internal application use and
I have a server application that uses a lot of threads. Without wanting to
I have an application that needs to make a SOAP client request to a
In Flex 3 application I use HTTPService class to make requests to the server:
Hi there I am wanting to make a personal rain radar application with information
I have been wanting to make a RSS reader for a while now (just
I am wanting to send some data to a server from a client application
I'm wanting to make an API quickly, following REST principles - for a simple
I have just made my first proper little desktop GUI application that basically wraps

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.