public static string ToCSharpTypeName(this ModelPropertyType modelPropertyType) { if (modelPropertyType == null) { throw new ArgumentNullException(nameof(modelPropertyType)); } if (!string.IsNullOrWhiteSpace(modelPropertyType.ObjectTypeName)) { if (modelPropertyType.GenericArgumentTypes.Any()) { if (modelPropertyType.ObjectTypeName.Equals(nameof(Nullable), StringComparison.Ordinal) && modelPropertyType.GenericArgumentTypes.Count == 1) { return($"{modelPropertyType.GenericArgumentTypes.Single().ToCSharpTypeName()}?"); } var sb = new StringBuilder($"{modelPropertyType.ObjectTypeName}<"); var isFirstArgument = true; foreach (var genericArgumentType in modelPropertyType.GenericArgumentTypes) { if (!isFirstArgument) { _ = sb.Append(", "); } _ = sb.Append(genericArgumentType.ToCSharpTypeName()); isFirstArgument = false; } _ = sb.Append(">"); return(sb.ToString()); } return(modelPropertyType.ObjectTypeName); } if (modelPropertyType.ListItemType != null) { if (!string.IsNullOrWhiteSpace(modelPropertyType.ListItemType.ObjectTypeName)) { return($"IList<{modelPropertyType.ListItemType.ObjectTypeName}>"); } if (modelPropertyType.ListItemType.LogicalType == ModelPropertyLogicalType.KeyValuePair) { return("IDictionary<TKey, TValue>"); } return($"IList<{modelPropertyType.ListItemType.LogicalType.ToCSharpTypeName()}>"); } return(modelPropertyType.LogicalType.ToCSharpTypeName()); }
public void InitForIntegerPropertyChange(ushort id, ushort pid, ModelPropertyType modelpropertytype, ModificationType modificationtype, int value) { if (!IsInitialized) { Id = id; TargetId = pid; TargetItemType = TargetItemType.Property; ModificationType = modificationtype; ModificationDetails = (IModificationDetails)propertyFactory.Create(pid, value); IsInitialized = true; } }
public ModelProperty(ushort pid, ModelPropertyType modelPropertyType, IPropertyValue propertyValue) { Pid = pid; PropertyType = modelPropertyType; Value = propertyValue; }