Exemple #1
0
        public void SetReference(string propertyName, IUpdateInstance instance)
        {
            Func <ResourceProperty, bool> func = null;

            if (instance != null)
            {
                Dictionary <string, object> keyValues = instance.GetKeyValues();
                if (keyValues.Count <= 1)
                {
                    foreach (KeyValuePair <string, object> keyValue in keyValues)
                    {
                        this.propertyUpdates[propertyName] = keyValue.Value;
                    }
                    return;
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            else
            {
                SortedDictionary <string, object> defaultValue = this.propertyUpdates;
                string str = propertyName;
                ReadOnlyCollection <ResourceProperty> properties = this.resourceType.Properties;
                if (func == null)
                {
                    func = (ResourceProperty p) => p.Name == propertyName;
                }
                defaultValue[str] = properties.Single <ResourceProperty>(func).GetCustomState().DefaultValue;
                return;
            }
        }
Exemple #2
0
		public void SetReference(string propertyName, IUpdateInstance instance)
		{
			Func<ResourceProperty, bool> func = null;
			if (instance != null)
			{
				Dictionary<string, object> keyValues = instance.GetKeyValues();
				if (keyValues.Count <= 1)
				{
					foreach (KeyValuePair<string, object> keyValue in keyValues)
					{
						this.propertyUpdates[propertyName] = keyValue.Value;
					}
					return;
				}
				else
				{
					throw new NotImplementedException();
				}
			}
			else
			{
				SortedDictionary<string, object> defaultValue = this.propertyUpdates;
				string str = propertyName;
				ReadOnlyCollection<ResourceProperty> properties = this.resourceType.Properties;
				if (func == null)
				{
					func = (ResourceProperty p) => p.Name == propertyName;
				}
				defaultValue[str] = properties.Single<ResourceProperty>(func).GetCustomState().DefaultValue;
				return;
			}
		}