static CoflnetUser() { // register commands commandController = new CommandController(persistenceCommands); commandController.RegisterCommand <GetUserKeyValue> (); commandController.RegisterCommand <SetUserKeyValue> (); }
/// <summary> /// Initializes the <see cref="T:Coflnet.<see cref="Entity"/>"/> class. /// </summary> static Entity() { globalCommands = new CommandController(); globalCommands.RegisterCommand <ReturnResponseCommand> (); globalCommands.RegisterCommand <GetResourceCommand>(); globalCommands.RegisterCommand <CreationResponseCommand>(); globalCommands.RegisterCommand <SubscribeCommand>(); }
static Device() { commandController = new CommandController(persistenceCommands); commandController.RegisterCommand <DeviceInstalledCommand>(); //commandController.RegisterCommand<AddUserCommand>(); commandController.RegisterCommand <RemoveUserCommand>(); // Add commands for the users list RemoteList <Reference <CoflnetUser> > .AddCommands (commandController, nameof(Users), m => m.GetTargetAs <Device>().Users , m => new Reference <CoflnetUser>(m.GetAs <EntityId>())); // Add commands for the installed apps list RemoteList <string> .AddCommands (commandController, nameof(InstalledApps), m => m.GetTargetAs <Device>().InstalledApps); }
/// <summary> /// Adds Add,AddRange,Remove,RemoveAt,RemoveRange,Insert,InsertRange and Clear commands for any list on any entitys /// </summary> /// <param name="controller">The controller of the <see cref="Entity"/> to add the commands to</param> /// <param name="prefix">The prefix for the commands, usually the attribute name</param> /// <param name="ListGetter">A function that returns the actual list to operate on, given the target <see cref="Entity"/> </param> /// <param name="Converter">A function that converts the data given in the <see cref="CommandData"/> content to the List type</param> /// <param name="localPropagation">Set to true if commands don't have to pass the managing server first to be applied locally</param> /// <typeparam name="R">The target <see cref="Entity"/> type</typeparam> /// <typeparam name="T">The type of the list elements</typeparam> public static void AddCommands(CommandController controller, string prefix, Func <CommandData, List <T> > ListGetter, Func <CommandData, T> Converter = null, bool localPropagation = false) { controller.RegisterCommand(new GetCommand(prefix, ListGetter)); // commands have no plural s prefix = prefix.Trim('s'); controller.RegisterCommand(new RemoteCollectionAddCommand <T>(prefix, ListGetter, localPropagation)); controller.RegisterCommand(new RemoteListRemoveCommand <T>(prefix, ListGetter, Converter)); controller.RegisterCommand(new RemoteListRemoveAtCommand <T>(prefix, ListGetter, Converter)); controller.RegisterCommand(new RemoteCollectionClearCommand <T>(prefix, ListGetter, localPropagation)); controller.RegisterCommand(new RemoteListAddRangeCommand <T>(prefix, ListGetter, null)); controller.RegisterCommand(new RemoteListRemoveRangeCommand <T>(prefix, ListGetter, Converter)); controller.RegisterCommand(new RemoteListInsertRangeCommand <T>(prefix, ListGetter, Converter)); controller.RegisterCommand(new RemoteListInsertCommand <T>(prefix, ListGetter, Converter)); }
static ReceiveableResource() { persistenceCommands = new CommandController(globalCommands); persistenceCommands.RegisterCommand <GetMessages> (); persistenceCommands.RegisterCommand <ReceiveConfirm>(); }
static Installation() { _commands = new CommandController(persistenceCommands); _commands.RegisterCommand <CreateUser>(); }
static DistributionResource() { _commandController = new CommandController(); _commandController.RegisterCommand <Distribute> (); }