public object Resolve() { if (this.factory == null) { ResourceCustomState customState = this.resourceType.CustomState as ResourceCustomState; if (customState != null) { foreach (string list in this.properties.Keys.ToList <string>()) { object item = this.properties[list]; item = EntityUpdate.ResolveUpdatableObject(item); item = EntityUpdate.ResolveUpdatableObjectList(item); this.properties[list] = item; } return(ComplexTypeInstance.ClrInstanceForComplexTypeBuilder.Build(customState.ClrType, this.properties)); } else { throw new InvalidOperationException(ExceptionHelpers.GetExceptionMessage(Resources.ResourceCustomStateNull, new object[0])); } } else { return(this.factory(this.properties)); } }
private void AddPropertyUpdates(ICommand command) { foreach (KeyValuePair <string, object> propertyUpdate in this.propertyUpdates) { Func <ResourceProperty, bool> func = null; KeyValuePair <string, object> keyValuePair1 = propertyUpdate; if (!command.CanFieldBeAdded(keyValuePair1.Key)) { continue; } KeyValuePair <string, object> keyValuePair2 = propertyUpdate; object value = keyValuePair2.Value; value = EntityUpdate.ResolveUpdatableObject(value); value = EntityUpdate.ResolveUpdatableObjectList(value); if (value == null && this.commandType == CommandType.Create) { ReadOnlyCollection <ResourceProperty> properties = this.resourceType.Properties; if (func == null) { func = (ResourceProperty item) => { KeyValuePair <string, object> keyValuePair = propertyUpdate; return(item.Name == keyValuePair.Key); } ; } ResourceProperty resourceProperty = properties.First <ResourceProperty>(func); if (resourceProperty.ResourceType.IsNullable()) { continue; } } KeyValuePair <string, object> keyValuePair3 = propertyUpdate; command.AddFieldParameter(keyValuePair3.Key, value); } }
internal static object ResolveUpdatableObjectList(object list) { if (list == null || !TypeSystem.ContainsEnumerableInterface(list.GetType())) { return(list); } else { IEnumerable enumerable = list as IEnumerable; ArrayList arrayLists = new ArrayList(); foreach (object obj in enumerable) { arrayLists.Add(EntityUpdate.ResolveUpdatableObject(obj)); } return(arrayLists); } }