public AttributeInfo AddPseudoAttribute(string name, AttributeTypeCode attTypeCode, AttributeTypeDisplayName attDisplayName = null) { var factory = new AttributeInfoFactory(); var attInfo = factory.CreatePseudo(this.EntityName, name, attTypeCode, attDisplayName); this.Attributes.Add(attInfo); return attInfo; }
/// <summary> /// Gets the sql datatype name for the attribute type. /// </summary> /// <param name="metadata"></param> /// <returns></returns> public static string GetSqlDataTypeName(this AttributeTypeCode attType, AttributeTypeDisplayName attTypeDisplayName) { switch (attType) { case AttributeTypeCode.String: case AttributeTypeCode.Memo: case AttributeTypeCode.EntityName: return("nvarchar"); case AttributeTypeCode.Lookup: case AttributeTypeCode.Owner: case AttributeTypeCode.Customer: case AttributeTypeCode.Uniqueidentifier: return("uniqueidentifier"); case AttributeTypeCode.Virtual: if (attTypeDisplayName != null && attTypeDisplayName.Value == AttributeTypeDisplayName.ImageType.Value) { return("image"); } return("nvarchar"); case AttributeTypeCode.Double: return("float"); case AttributeTypeCode.Decimal: return("decimal"); case AttributeTypeCode.State: case AttributeTypeCode.Status: case AttributeTypeCode.Picklist: case AttributeTypeCode.Integer: return("int"); case AttributeTypeCode.Boolean: case AttributeTypeCode.ManagedProperty: return("bit"); case AttributeTypeCode.DateTime: return("datetime"); case AttributeTypeCode.Money: return("money"); case AttributeTypeCode.BigInt: return("bigint"); default: return(attType.ToString().ToLower()); } }
public virtual AttributeInfo CreatePseudo(string entityName, string logicalName, AttributeTypeCode attTypeCode, AttributeTypeDisplayName attDisplayName = null) { var newAtt = new PseudoAttributeInfo(); newAtt.AttributeType = attTypeCode; newAtt.AttributeOf = string.Empty; newAtt.AttributeType = attTypeCode; if (attDisplayName == null) { newAtt.AttributeTypeDisplayName = GetAttributeTypeDisplayName(attTypeCode); } else { newAtt.AttributeTypeDisplayName = attDisplayName; } newAtt.CanBeSecuredForCreate = false; newAtt.CanBeSecuredForRead = false; newAtt.CanBeSecuredForUpdate = false; newAtt.CanModifyAdditionalSettings = false; // newAtt.ColumnNumber = attributeMetadata.ColumnNumber; //newAtt.DataType = attributeMetadata.GetSqlDataType newAtt.DeprecatedVersion = string.Empty; newAtt.Description = string.Empty; newAtt.DisplayName = string.Empty; newAtt.EntityLogicalName = entityName; // newAtt.IdentityIncrement; // newAtt.IdentitySeed; newAtt.IntroducedVersion = string.Empty; newAtt.IsAuditEnabled = false; newAtt.IsCustomAttribute = true; newAtt.IsCustomizable = false; // newAtt.IsIdentity = GetBooleanManagedValue(attributeMetadata.is); newAtt.IsManaged = false; newAtt.IsPrimaryId = false; newAtt.IsPrimaryName = false; newAtt.IsPseudo = true; newAtt.IsRenameable = false; newAtt.IsSecured = false; newAtt.IsValidForAdvancedFind = false; newAtt.IsValidForCreate = false; newAtt.IsValidForRead = false; newAtt.IsValidForUpdate = false; //newAtt.Length newAtt.LinkedAttributeId = null; newAtt.LogicalName = logicalName; newAtt.MetadataId = Guid.Empty; newAtt.RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None); newAtt.SchemaName = logicalName; return newAtt; }
public AttributeInfo AddPseudoAttribute(string name, AttributeTypeCode attTypeCode, AttributeTypeDisplayName attDisplayName = null) { var factory = new AttributeInfoFactory(); var attInfo = factory.CreatePseudo(this.EntityName, name, attTypeCode, attDisplayName); this.Attributes.Add(attInfo); return(attInfo); }
/// <summary> /// Gets the sql datatype name for the attribute type. /// </summary> /// <param name="metadata"></param> /// <returns></returns> public static string GetSqlDataTypeName(this AttributeTypeCode attType, AttributeTypeDisplayName attTypeDisplayName) { switch (attType) { case AttributeTypeCode.String: case AttributeTypeCode.Memo: case AttributeTypeCode.EntityName: return "nvarchar"; case AttributeTypeCode.Lookup: case AttributeTypeCode.Owner: case AttributeTypeCode.Customer: case AttributeTypeCode.Uniqueidentifier: return "uniqueidentifier"; case AttributeTypeCode.Virtual: if (attTypeDisplayName != null && attTypeDisplayName.Value == AttributeTypeDisplayName.ImageType.Value) { return "image"; } return "nvarchar"; case AttributeTypeCode.Double: return "float"; case AttributeTypeCode.Decimal: return "decimal"; case AttributeTypeCode.State: case AttributeTypeCode.Status: case AttributeTypeCode.Picklist: case AttributeTypeCode.Integer: return "int"; case AttributeTypeCode.Boolean: case AttributeTypeCode.ManagedProperty: return "bit"; case AttributeTypeCode.DateTime: return "datetime"; case AttributeTypeCode.Money: return "money"; case AttributeTypeCode.BigInt: return "bigint"; default: return attType.ToString().ToLower(); } }
private AttributeTypeDisplayName GetAttributeTypeDisplayName(AttributeTypeCode attTypeCode) { AttributeTypeDisplayName displayType = null; switch (attTypeCode) { case AttributeTypeCode.BigInt: displayType = AttributeTypeDisplayName.BigIntType; break; case AttributeTypeCode.Boolean: displayType = AttributeTypeDisplayName.BooleanType; break; case AttributeTypeCode.CalendarRules: displayType = AttributeTypeDisplayName.CalendarRulesType; break; case AttributeTypeCode.Customer: displayType = AttributeTypeDisplayName.CustomerType; break; case AttributeTypeCode.DateTime: displayType = AttributeTypeDisplayName.DateTimeType; break; case AttributeTypeCode.Decimal: displayType = AttributeTypeDisplayName.DecimalType; break; case AttributeTypeCode.Double: displayType = AttributeTypeDisplayName.DoubleType; break; case AttributeTypeCode.EntityName: displayType = AttributeTypeDisplayName.EntityNameType; break; case AttributeTypeCode.Integer: displayType = AttributeTypeDisplayName.IntegerType; break; case AttributeTypeCode.Lookup: displayType = AttributeTypeDisplayName.LookupType; break; case AttributeTypeCode.ManagedProperty: displayType = AttributeTypeDisplayName.ManagedPropertyType; break; case AttributeTypeCode.Memo: displayType = AttributeTypeDisplayName.MemoType; break; case AttributeTypeCode.Money: displayType = AttributeTypeDisplayName.MoneyType; break; case AttributeTypeCode.Owner: displayType = AttributeTypeDisplayName.OwnerType; break; case AttributeTypeCode.PartyList: displayType = AttributeTypeDisplayName.PartyListType; break; case AttributeTypeCode.Picklist: displayType = AttributeTypeDisplayName.PicklistType; break; case AttributeTypeCode.State: displayType = AttributeTypeDisplayName.StateType; break; case AttributeTypeCode.Status: displayType = AttributeTypeDisplayName.StatusType; break; case AttributeTypeCode.String: displayType = AttributeTypeDisplayName.StringType; break; case AttributeTypeCode.Uniqueidentifier: displayType = AttributeTypeDisplayName.UniqueidentifierType; break; case AttributeTypeCode.Virtual: displayType = AttributeTypeDisplayName.VirtualType; break; } return(displayType); }
public virtual AttributeInfo CreatePseudo(string entityName, string logicalName, AttributeTypeCode attTypeCode, AttributeTypeDisplayName attDisplayName = null) { var newAtt = new PseudoAttributeInfo(); newAtt.AttributeType = attTypeCode; newAtt.AttributeOf = string.Empty; newAtt.AttributeType = attTypeCode; if (attDisplayName == null) { newAtt.AttributeTypeDisplayName = GetAttributeTypeDisplayName(attTypeCode); } else { newAtt.AttributeTypeDisplayName = attDisplayName; } newAtt.CanBeSecuredForCreate = false; newAtt.CanBeSecuredForRead = false; newAtt.CanBeSecuredForUpdate = false; newAtt.CanModifyAdditionalSettings = false; // newAtt.ColumnNumber = attributeMetadata.ColumnNumber; //newAtt.DataType = attributeMetadata.GetSqlDataType newAtt.DeprecatedVersion = string.Empty; newAtt.Description = string.Empty; newAtt.DisplayName = string.Empty; newAtt.EntityLogicalName = entityName; // newAtt.IdentityIncrement; // newAtt.IdentitySeed; newAtt.IntroducedVersion = string.Empty; newAtt.IsAuditEnabled = false; newAtt.IsCustomAttribute = true; newAtt.IsCustomizable = false; // newAtt.IsIdentity = GetBooleanManagedValue(attributeMetadata.is); newAtt.IsManaged = false; newAtt.IsPrimaryId = false; newAtt.IsPrimaryName = false; newAtt.IsPseudo = true; newAtt.IsRenameable = false; newAtt.IsSecured = false; newAtt.IsValidForAdvancedFind = false; newAtt.IsValidForCreate = false; newAtt.IsValidForRead = false; newAtt.IsValidForUpdate = false; //newAtt.Length newAtt.LinkedAttributeId = null; newAtt.LogicalName = logicalName; newAtt.MetadataId = Guid.Empty; newAtt.RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None); newAtt.SchemaName = logicalName; return(newAtt); }