Example #1
0
        public ICommand Execute(ICommand command)
        {
            foreach (var key in command.getOptions().Keys)
            {
                command.getOptions().TryGetValue(key, out string value);
                command.AddLine($"{key}={value}");
            }
            // - need: entity type, key, other properties (as JSON?)
            // Entity instance from entityID
            command.getOptions().TryGetValue(ModelKeyAdd.p_entity, out string entityID);
            var baseModelKey = ModelUtils.NewEntityInstance(entityID);

            if (baseModelKey == null)
            {
                // exit command, user input invalid
                command.Abort($"Unknown entityID: {entityID}");
                return(command);
            }
            // Set entity key
            command.getOptions().TryGetValue(ModelKeyAdd.p_entity_key, out string entityKey);
            baseModelKey.Key = entityKey;
            // @TODO_GUN: Set other properties
            // Persist: get persistence services and persist it
            ServicesProviderBridge._modelKeyDAODict.TryGetValue(baseModelKey.GetType(), out IModelKeyDAO modelKeyDAO);
            modelKeyDAO.Add(baseModelKey);
            return(command);
        }
Example #2
0
        public ICommand Execute(ICommand command)
        {
            Type     parentType = typeof(BaseModelKey);
            Assembly assembly   = Assembly.GetExecutingAssembly();

            Type[]             types      = assembly.GetTypes();
            IEnumerable <Type> subclasses = types.Where(t => t.IsSubclassOf(parentType));

            foreach (Type type in subclasses)
            {
                command.AddLine(type.Name);
            }
            return(command);
        }
Example #3
0
 public ICommand Execute(ICommand command)
 {
     command.AddLine("Command unknown!");
     return(command);
 }