示例#1
0
 public SchemaItem Get(String identifier)
 {
     if (p.ContainsKey(identifier))
     {
         return(p[identifier]);
     }
     else
     {
         return(null);
     }
 }
示例#2
0
        /*
         * public SchemaEditor Add(String identifier, String sourceTable)
         * {
         *  if (!schemaInstance.ContainsKey(identifier))
         *  {
         *      schemaInstance.Add(identifier, new SchemaNode { ID = identifier, DBName = sourceTable });
         *  } else
         *  {
         *      throw new ArgumentException($"Entity with identifier {identifier} already exists.");
         *  }
         *
         *  return this;
         * }
         */

        /// <summary>
        /// Add new Entity to the schema. Use StormAttributes to decorate the fields and properties of the TModel to describe the entity.
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <param name="identifier"></param>
        /// <param name="sourceTable"></param>
        /// <returns></returns>
        public SchemaEditor Add <TModel>(String identifier, String sourceTable)
        {
            if (!schemaInstance.ContainsKey(identifier))
            {
                schemaInstance.Add(identifier, parseModel(this, identifier, sourceTable, typeof(TModel)));
            }
            else
            {
                throw new ArgumentException($"Entity with identifier {identifier} already exists.");
            }
            return(this);
        }