public ColumnMapping(object anonymousType) : this() { foreach (var p in anonymousType.GetType().GetProperties()) { var value = p.GetValue(anonymousType, null); var name = p.Name.ToLower(); if (name.EndsWith("enum") && value.GetType().BaseType == typeof(System.Enum)) { value = new Microsoft.Xrm.Sdk.OptionSetValue((int)value); name = name.Remove(name.Length - "enum".Length); } switch (name) { case "id": base.Id = (System.Guid)value; Attributes["columnmappingid"] = base.Id; break; case "columnmappingid": var id = (System.Nullable <System.Guid>)value; if (id == null) { continue; } base.Id = id.Value; Attributes[name] = base.Id; break; case "formattedvalues": // Add Support for FormattedValues FormattedValues.AddRange((Microsoft.Xrm.Sdk.FormattedValueCollection)value); break; default: Attributes[name] = value; break; } } }
public PostComment(object anonymousType) : this() { foreach (var p in anonymousType.GetType().GetProperties()) { var value = p.GetValue(anonymousType, null); if (p.PropertyType == typeof(System.Guid)) { // Type is Guid, must be Id base.Id = (System.Guid)value; Attributes["postcommentid"] = base.Id; } else if (p.Name == "FormattedValues") { // Add Support for FormattedValues FormattedValues.AddRange((Microsoft.Xrm.Sdk.FormattedValueCollection)value); } else { Attributes[p.Name.ToLower()] = value; } } }
public HierarchySecurityConfiguration(object anonymousType) : this() { foreach (var p in anonymousType.GetType().GetProperties()) { var value = p.GetValue(anonymousType, null); if (p.PropertyType == typeof(System.Guid)) { // Type is Guid, must be Id base.Id = (System.Guid)value; Attributes["hierarchysecuritymodelingsettingid"] = base.Id; } else if (p.Name == "FormattedValues") { // Add Support for FormattedValues FormattedValues.AddRange((Microsoft.Xrm.Sdk.FormattedValueCollection)value); } else { Attributes[p.Name.ToLower()] = value; } } }
public SdkMessageProcessingStepSecureConfig(object anonymousType) : this() { foreach (var p in anonymousType.GetType().GetProperties()) { var value = p.GetValue(anonymousType, null); if (p.PropertyType == typeof(System.Guid)) { // Type is Guid, must be Id base.Id = (System.Guid)value; Attributes["sdkmessageprocessingstepsecureconfigid"] = base.Id; } else if (p.Name == "FormattedValues") { // Add Support for FormattedValues FormattedValues.AddRange((Microsoft.Xrm.Sdk.FormattedValueCollection)value); } else { Attributes[p.Name.ToLower()] = value; } } }