public void Activate() { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("*******************"); Console.WriteLine("* ClientMaker *"); Console.WriteLine("*******************"); Console.WriteLine(@"This extension will generate the source files (.cs) of classes to access your server's controllers and actions."); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(@"WARNING: supported methods must have the annotation / attribute [ServerAction], and also cannot return ActionResult. Instead, return void or your return object directly"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Answer the following parameters: \n"); FillParameters(); IServiceManager manager = ServiceManager.GetInstance(); ILoggingService logging = manager.GetService <ILoggingService>(); IDomainModelsManager models = manager.GetService <IDomainModelsManager>(); IControllerManager controllers = manager.GetService <IControllerManager>(); foreach (ControllerRegister controller in controllers.GetRegisteredControllers()) { if (controller.Type.Name != "ServerInfoController") { WriteControllerClient(controller); } } }
public TypedObjectsRequestManager() { IServiceManager manager = ServiceManager.GetInstance(); logger = manager.GetService <ILoggingService>(); controllerManager = manager.GetService <IControllerManager>(); modelsManager = manager.GetService <IDomainModelsManager>(); encoder = manager.GetService <IEncodingConverterService>(); }
/// <summary> /// Adds a set of model classes to the server. A scan will be performed on the specified Assembly namespace to search for possible classes and register them automatically /// </summary> /// <param name="assembly"></param> /// <param name="namespaceName"></param> protected void RegisterAllModels(Assembly assembly, string namespaceName) { IDomainModelsManager manager = Services.GetService <IDomainModelsManager>(); manager.RegisterAllModels(assembly, namespaceName); }
/// <summary> /// Registers a model class so that the Controller can inject them into the Actions they need /// </summary> /// <param name="modelType">Base type of the class to be registered</param> protected void RegisterModel(Type modelType) { IDomainModelsManager manager = Services.GetService <IDomainModelsManager>(); manager.RegisterModelType(modelType); }