Beispiel #1
0
 /// <summary>
 /// Creates the specified name.
 /// </summary>
 /// <param name="Name">The name.</param>
 /// <param name="FriendlyName">Name of the friendly.</param>
 /// <param name="TableName">Name of the table.</param>
 /// <param name="ParentId">The parent id.</param>
 /// <param name="type">The type.</param>
 /// <param name="Description">The description.</param>
 /// <returns></returns>
 public static MetaClass Create(string name, string friendlyName, string tableName, int parentId, MetaClassType type, string description)
 {
     return MetaClass.Create((type == MetaClassType.System) ? MetaNamespace.SystemRoot : MetaNamespace.UserRoot, name, friendlyName, tableName, parentId, type, description);
 }
Beispiel #2
0
        /// <summary>
        /// Creates the specified namespace.
        /// </summary>
        /// <param name="Namespace">The namespace.</param>
        /// <param name="Name">The name.</param>
        /// <param name="FriendlyName">Name of the friendly.</param>
        /// <param name="TableName">Name of the table.</param>
        /// <param name="ParentId">The parent id.</param>
        /// <param name="type">The type.</param>
        /// <param name="Description">The description.</param>
        /// <returns></returns>
        public static MetaClass Create(string metaNamespace, string name, string friendlyName, string tableName, int parentId, MetaClassType type, string description)
        {
            #region ArgumentNullExceptions
            if (metaNamespace == null)
                throw new ArgumentNullException("Namespace", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            if (name == null)
                throw new ArgumentNullException("Name", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            if (friendlyName == null)
                throw new ArgumentNullException("FriendlyName", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            if (tableName == null)
                throw new ArgumentNullException("TableName", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            #endregion

            SqlParameter Retval = new SqlParameter("@Retval", SqlDbType.Int, 4);
            Retval.Direction = ParameterDirection.Output;

            SqlParameter[] sqlParameters = new SqlParameter[] {
                                                                   new SqlParameter("@Namespace",  metaNamespace),
                                                                   new SqlParameter("@Name", name),
                                                                   new SqlParameter("@FriendlyName", friendlyName),
                                                                   new SqlParameter("@TableName", tableName),
                                                                   new SqlParameter("@Description", SqlHelper.Null2DBNull(description)),
                                                                   new SqlParameter("@ParentClassId", parentId),
                                                                   new SqlParameter("@IsSystem", type==MetaClassType.System),
                                                                   new SqlParameter("@IsAbstract", type==MetaClassType.Abstract),
                                                                   Retval
                                                               };

            SqlHelper.ExecuteNonQuery(MetaDataContext.Current, CommandType.StoredProcedure, AsyncResources.GetConstantValue("SP_CreateMetaClass"), sqlParameters);

            return MetaClass.Load((int)Retval.Value);
        }
Beispiel #3
0
 /// <summary>
 /// Creates the specified namespace.
 /// </summary>
 /// <param name="Namespace">The namespace.</param>
 /// <param name="Name">The name.</param>
 /// <param name="FriendlyName">Name of the friendly.</param>
 /// <param name="TableName">Name of the table.</param>
 /// <param name="Parent">The parent.</param>
 /// <param name="type">The type.</param>
 /// <param name="Description">The description.</param>
 /// <returns></returns>
 public static MetaClass Create(string metaNamespace, string name, string friendlyName, string tableName, MetaClass parent, MetaClassType type, string description)
 {
     return MetaClass.Create(metaNamespace, name, friendlyName, tableName, parent == null ? 0 : parent.Id, type, description);
 }