api - c# accessing methods based on condition -


i have application have 2 parts (2 separate application): designer (call configurationbuilder) , executer (call configurationexecutor).

there class library object consist of manager class , shared above applications. within configurationbuilder user can run custom code consume methods of manager class , these methods create objects. (serialize , create dbtables)

configurationexecutor user consume methods of manager class , these methods create rows on tables.

now, want prevent user consuming api in configurationbuilder sepcific configurationexecutor , vise-versa.

appreciate sharing best practices.

thanks.

create 2 interface separate methods suppose manager class

class manager() {  method1();  method2();  method3();  method4();  } 

divide methods in interfaces

imethodsforconfigurationbuilder  {   method1();   method2();  }   imethodsforconfigurationexecutor  {   method3();   method4();  }  

implement these interfaces in on manager

manager : imethodsforconfigurationbuilder,  imethodsforconfigurationexecutor {  method1();  method2();  method3();  method4();  }  // in configurationbuilder  class    { imethodsforconfigurationbuilder  manager = new manager();}  //and in configurationexecutor classs call  imethodsforconfigurationexecutor manager = new manager(); 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -