public void OverrideIsOpenType(ResourceType type, bool value) { type.Facets.IsOpenType = value; RequestUtil.GetAndVerifyStatusCode(this, this.ServiceUri + "/SetIsOpenType?resourceTypeName='" + this.ContextNamespace + "." + type.Name + "'&value=" + value.ToString().ToLowerInvariant(), System.Net.HttpStatusCode.NoContent); }
public static KeyExpression GetContainingKey(this ContainmentAttribute att, KeyExpression childKey, ResourceType parentType, bool abbreviate) { AstoriaTestLog.Compare(childKey.ResourceContainer == att.ChildContainer, String.Format("ChildKey does not belong to expected set (Expected '{0}', got '{1}'", att.ChildContainer.Name, childKey.ResourceContainer.Name)); List<PropertyExpression> parentProperties = new List<PropertyExpression>(); List<ConstantExpression> parentValues = new List<ConstantExpression>(); foreach (NodeProperty p_prop in att.ParentContainer.BaseType.Key.Properties) { string c_name; if (!att.KeyMapping.TryGetValue(p_prop.Name, out c_name)) AstoriaTestLog.FailAndThrow(String.Format("Parent key property {0} does not appear in derived key mapping", p_prop.Name)); // need to get the offset now int c_offset = 0; for (; c_offset < childKey.Properties.Length; c_offset++) { if (childKey.Properties[c_offset].Name == c_name) break; } if (c_offset >= childKey.Properties.Length) AstoriaTestLog.FailAndThrow(String.Format("Could not find property '{0}' in child key", c_name)); NodeProperty c_prop = childKey.Properties[c_offset]; parentProperties.Add(p_prop.Property()); parentValues.Add(new ConstantExpression(childKey.Values[c_offset])); if (abbreviate) childKey.IncludeInUri[c_offset] = false; } return new KeyExpression(att.ParentContainer, parentType, parentProperties.ToArray(), parentValues.ToArray()); }
public ConcurrencyAttribute(ResourceType type, IEnumerable<string> propertyNames) : base("ETag") { etagProperties = type.Properties.OfType<ResourceProperty>().Where(p => propertyNames.Contains(p.Name)).ToList(); etagProperties.ForEach(p => p.Facets.Add(NodeFacet.ConcurrencyModeFixed())); this.orderedParams = etagProperties.Select(p => "\"" + p.Name + "\"").ToList(); }
public ResourceType(String name, string typeNamespace, ResourceType baseType, params Node[] properties) : base(name, typeNamespace, baseType, properties) { _desc = "ResourceType"; this.Key = (base.BaseType as ResourceType).Key; this.InferAssociations(); }
//Constructor public PredicateModel(Workspace w,ResourceContainer container, ResourceProperty p, KeyExpression parentKey, ResourceType resType) { _resourceContainer = container; _workspace = w; _resType = resType; _key = parentKey; _prop = p; }
public OpenTypeResourceAttribute(ResourceType type, string propertyName, Func<ResourceProperty, bool> declaredPropertyFilter) : base("OpenType") { this.orderedParams = new List<string>() { "\"" + propertyName + "\"" }; this.PropertyName = propertyName; type.Facets.Add(NodeFacet.IsOpenType()); foreach (ResourceProperty property in type.Properties.OfType<ResourceProperty>()) { if (!declaredPropertyFilter(property)) property.Facets.IsDeclaredProperty = false; } }
public NamedStreamResourceAttribute(ResourceType type, string name) : base("NamedStream") { this.type = type; this.name = name; this.orderedParams = new List<string>() { '"' + name + '"' }; type.Facets.NamedStreams.Add(name); if (type.HasDerivedTypes) { foreach (ResourceType derived in type.DerivedTypes) { derived.Facets.NamedStreams.Add(name); } } }
protected virtual KeyExpression GetKeyExpression(ResourceContainer container, ResourceType resourceType, object o) { return Exp.Key(container, resourceType, GetPropertyValues(o)); }
public static KeyedResourceInstance CreateKeyedResourceInstanceByClone(ResourceContainer container, ResourceType resourceType, bool excludeRelationships) { Workspace workspace = container.Workspace; //Clone for an existing resource, and update its key KeyExpression keyExpression = workspace.GetRandomExistingKey(container, resourceType); if (keyExpression == null) return null; KeyedResourceInstance dataObject = workspace.GetSingleResourceByKey(keyExpression); if (dataObject == null) return null; ResourceInstanceKey key = null; // if there are any non-server-generated key properties, then we need to build the key if (keyExpression.ResourceType.Properties.Any(p => p.PrimaryKey != null && !p.Facets.ServerGenerated)) { ResourceType newResourceType = container.ResourceTypes.Where(rt => rt.Name == dataObject.TypeName).FirstOrDefault(); key = CreateUniqueKey(container, newResourceType); } //Foreach property in dataObject create a ResourceProperty List<ResourceInstanceProperty> properties = new List<ResourceInstanceProperty>(); properties.AddRange(dataObject.Properties.OfType<ResourceInstanceSimpleProperty>().ToArray()); properties.AddRange(dataObject.Properties.OfType<ResourceInstanceComplexProperty>().ToArray()); if (!excludeRelationships) properties.AddRange(CloneRequiredRelationships(container, keyExpression.ResourceType, keyExpression)); KeyedResourceInstance keyResourceInstance = null; if (key != null) keyResourceInstance = new KeyedResourceInstance(key, properties.ToArray()); else keyResourceInstance = new KeyedResourceInstance(dataObject.ResourceSetName, dataObject.TypeName, properties.ToArray()); return keyResourceInstance; }
public static void Verify(Workspace w, ExpNode q, IEnumerable results, ResourceType resType, ComplexType cType, bool bCount) { long count = 0; if (bCount) { object[] args = new object[] { results }; Type qorType = typeof(QueryOperationResponseWrapper<>).MakeGenericType(resType.ClientClrType); object qor = Activator.CreateInstance(qorType, args); PropertyInfo pi = qor.GetType().GetProperty("GetTotalCount"); object i = pi.GetValue(qor, new object[] { }); count = (long)i; LinqQueryBuilder lb = new LinqQueryBuilder(w); lb.CountingMode = true; lb.Build(q); object baselineElementsCount = CommonPayload.CreateList(lb.QueryResult).Count; AstoriaTestLog.IsTrue(count == Convert.ToInt64(baselineElementsCount), "Count is different.Count is " + count.ToString() + ". Baseline count is " + baselineElementsCount.ToString()); } LinqQueryBuilder linqBuilder = new LinqQueryBuilder(w); linqBuilder.Build(q); IQueryable baselines = linqBuilder.QueryResult; IEnumerator b = null; IEnumerator r = null; try { b = TrustedMethods.IQueryableGetEnumerator(baselines); r = results.GetEnumerator(); } catch (InvalidOperationException invalidOperation) { if (!AstoriaTestProperties.IsRemoteClient) throw invalidOperation; } PropertyInfo propertyInfo = null; Object expectedResult1 = null; Object expectedResult2 = null; try { while (b.MoveNext() && r.MoveNext()) { if (b.Current == null) { return; } if (r.Current == null) { throw new TestFailedException("Less results than expected"); } //skip verification for Binary data type for Linq to Sql if (AstoriaTestProperties.DataLayerProviderKinds[0] == DataLayerProviderKind.LinqToSql && b.Current is System.Byte[]) return; if (b.Current is System.Byte[]) { byte[] newBase = (byte[])b.Current; byte[] newAct = (byte[])r.Current; if (newBase.Length != newAct.Length) throw new TestFailedException("Failed to compare the results!"); } #if !ClientSKUFramework else if (b.Current is System.Data.Linq.Binary) { System.Data.Linq.Binary newBase = (System.Data.Linq.Binary)b.Current; System.Data.Linq.Binary newAct = new System.Data.Linq.Binary((byte[])r.Current); if (newBase.Length != newAct.Length) throw new TestFailedException("Failed to compare the results!"); } #endif else if (b.Current is System.Xml.Linq.XElement) { if (b.Current.ToString() != r.Current.ToString()) throw new TestFailedException("Failed to compare the results!"); } else { if (!b.Current.Equals(r.Current)) { if (cType != null) { foreach (ResourceProperty property in cType.Properties) { if (!property.IsNavigation && !property.IsComplexType && !(property.Type is CollectionType)) { propertyInfo = b.Current.GetType().GetProperty(property.Name); expectedResult1 = propertyInfo.GetValue(b.Current, null); PropertyInfo propertyInfo2 = r.Current.GetType().GetProperty(property.Name); expectedResult2 = propertyInfo2.GetValue(r.Current, null); if (expectedResult1 != expectedResult2) { if (expectedResult1 is System.Xml.Linq.XElement) { expectedResult1 = ((System.Xml.Linq.XElement)expectedResult1).ToString(System.Xml.Linq.SaveOptions.None); } if (expectedResult2 is System.Xml.Linq.XElement) { expectedResult2 = ((System.Xml.Linq.XElement)expectedResult2).ToString(System.Xml.Linq.SaveOptions.None); } #if !ClientSKUFramework if (expectedResult1 is byte[]) { expectedResult1 = new System.Data.Linq.Binary((byte[])expectedResult1); } if (expectedResult2 is byte[]) { expectedResult2 = new System.Data.Linq.Binary((byte[])expectedResult2); } #endif AstoriaTestLog.AreEqual(expectedResult1, expectedResult2, String.Format("Resource value for {0} does not match", property.Name), false); } } } } else { foreach (ResourceProperty property in resType.Properties) { if (!property.IsNavigation && !property.IsComplexType && !(property.Type is CollectionType)) { //skip verification for Binary data type for Linq to Sql if (AstoriaTestProperties.DataLayerProviderKinds[0] == DataLayerProviderKind.LinqToSql && property.Type.Name == "LinqToSqlBinary") return; propertyInfo = b.Current.GetType().GetProperty(property.Name); expectedResult1 = propertyInfo.GetValue(b.Current, null); PropertyInfo propertyinfo2 = r.Current.GetType().GetProperty(property.Name); expectedResult2 = propertyinfo2.GetValue(r.Current, null); if (expectedResult1 != expectedResult2) { if (expectedResult1 is System.Xml.Linq.XElement) { expectedResult1 = ((System.Xml.Linq.XElement)expectedResult1).ToString(System.Xml.Linq.SaveOptions.None); } if (expectedResult2 is System.Xml.Linq.XElement) { expectedResult2 = ((System.Xml.Linq.XElement)expectedResult2).ToString(System.Xml.Linq.SaveOptions.None); } #if !ClientSKUFramework if (expectedResult1 is byte[]) { expectedResult1 = new System.Data.Linq.Binary((byte[])expectedResult1); } if (expectedResult2 is byte[]) { expectedResult2 = new System.Data.Linq.Binary((byte[])expectedResult2); } #endif AstoriaTestLog.AreEqual(expectedResult1, expectedResult2, String.Format("Resource value for {0} does not match", property.Name), false); } } } } } } } } catch (Exception e) { AstoriaTestLog.WriteLine(e.ToString()); throw; } }
//Constructor public SortModel(Workspace w, ResourceType resType) { _resourceType = resType; _workspace = w; }
//Constructor public FirstExpression(QueryNode input, ResourceType resourceType) : base(input) { _resourceType = resourceType; }
public static ResourceInstanceKey CreateUniqueKey(ResourceContainer container, ResourceType resType) { return CreateUniqueKey(container, resType, new KeyExpressions()); }
public static OfTypeExpression OfType(this QueryNode input, ResourceType resourceType) { return new OfTypeExpression(input, resourceType); }
public static SingleOrDefaultExpression SingleOrDefault(this QueryNode input, ResourceType resourceType) { return new SingleOrDefaultExpression(input, resourceType); }
public static string ConstructEquivalentETag(ResourceType type, string ETag) { string[] pieces = SplitETag(ETag); List<NodeProperty> etagProperties = type.Properties.Where(p => p.Facets.ConcurrencyModeFixed).ToList(); for (int i = 0; i < pieces.Length; i++) { string piece = pieces[i]; if (piece == Null) continue; NodeProperty property = etagProperties[i]; NodeType propertyType = etagProperties[i].Type; if (propertyType == Clr.Types.String && property.Facets.FixedLength) { piece = piece.Trim('\''); if (piece.Length < property.Facets.MaxSize) piece = piece + " "; else if (piece.EndsWith(" ")) piece = piece.Remove(piece.Length - 1); piece = "'" + piece + "'"; } else if (propertyType.IsNumeric) { if (piece.Contains("INF") || piece.Contains("NaN")) continue; else if (piece.ToLower().Contains("e")) //must be a floating point { // add 0's and flip capitalization piece = piece.Replace("E%2b", "0e%2B0"); piece = piece.Replace("e%2b", "0E%2B0"); piece = piece.Replace("E%2B", "0e%2b0"); piece = piece.Replace("e%2B", "0E%2b0"); piece = piece.Replace("E+", "0e+0"); piece = piece.Replace("e+", "0E+0"); } else if (propertyType.ClrType == typeof(double) && !(piece.EndsWith("D") || piece.EndsWith("d"))) { if (!piece.Contains('.')) piece = piece + ".0"; else piece = piece + "0"; piece = piece + "E+0"; } else if (propertyType.ClrType == typeof(float) || propertyType.ClrType == typeof(Single) || propertyType.ClrType == typeof(double)) { if (!piece.Contains('.')) piece = piece.Insert(piece.Length - 1, ".0"); //just before the 'f' or 'D' else piece = piece.Insert(piece.Length - 1, "0"); //just before the 'f' or 'D' piece = piece.Insert(piece.Length - 1, "E+0"); } else if (propertyType.ClrType == typeof(decimal)) { if (!piece.Contains('.')) piece = piece.Insert(piece.Length - 1, ".0"); //just before the 'M' else piece = piece.Insert(piece.Length - 1, "0"); //just before the 'M' } if (piece.StartsWith("-")) piece = piece.Insert(1, "0"); else piece = "0" + piece; } pieces[i] = piece; } return ConstructETag(pieces); }
internal static ResourceInstanceKey CreateUniqueKey(ResourceContainer container, ResourceType resType, KeyExpressions relatedForeignKeys) { return CreateUniqueKey(container, resType, relatedForeignKeys, null); }
public static KeyedResourceInstance CreateKeyedResourceInstanceByClone(ResourceContainer container, ResourceType resourceType) { return CreateKeyedResourceInstanceByClone(container, resourceType, false); }
private static ResourceInstanceKey TryCreateUniqueResourceInstanceKey(ResourceContainer container, ResourceType resType, KeyExpressions relatedForeignKeys) { Workspace workspace = container.Workspace; List<ResourceInstanceSimpleProperty> keyProperties = new List<ResourceInstanceSimpleProperty>(); Dictionary<ResourceProperty, ResourceProperty> foreignKeyMap = resType.Key.Properties.OfType<ResourceProperty>() .Where(p => p.ForeignKeys.Any()) .ToDictionary(p => p, p => p.ForeignKeys.First().PrimaryKey.Properties.OfType<ResourceProperty>().First()); Dictionary<string, ResourceProperty> reverseForeignKeyMap = new Dictionary<string, ResourceProperty>(); foreach (KeyValuePair<ResourceProperty, ResourceProperty> pair in foreignKeyMap) reverseForeignKeyMap[pair.Value.Name] = pair.Key; Dictionary<ResourceProperty, object> propertyValues = new Dictionary<ResourceProperty, object>(); List<ResourceProperty> constrainedProperties = new List<ResourceProperty>(); foreach(ResourceProperty property in resType.Key.Properties.OfType<ResourceProperty>()) { if(foreignKeyMap.ContainsKey(property)) constrainedProperties.Add(property); else { NodeValue obj = (property.Type as PrimitiveType).CreateRandomValueForFacets(property.Facets); propertyValues[property] = obj.ClrValue; } } foreach (ResourceProperty currentProperty in constrainedProperties) { if (propertyValues.ContainsKey(currentProperty)) continue; ResourceProperty foreignProperty = foreignKeyMap[currentProperty]; ResourceContainer foreignContainer = container.FindDefaultRelatedContainer(foreignProperty.ResourceType); KeyExpression foreignKey = relatedForeignKeys.Where(k => k.ResourceContainer == foreignContainer).FirstOrDefault(); if (foreignKey == null) { KeyExpressions foreignKeys = workspace.GetAllExistingKeysOfType(foreignContainer, foreignProperty.ResourceType); while (foreignKey == null && foreignKeys.Any()) { foreignKey = foreignKeys.Choose(); // ensure that for every property in the key, it matches any local values for (int i = 0; i < foreignKey.Properties.Length; i++) { string keyPropertyName = foreignKey.Properties[i].Name; ResourceProperty localProperty; if (reverseForeignKeyMap.TryGetValue(keyPropertyName, out localProperty)) { object keyValue = foreignKey.Values[i].ClrValue; object localValue; if (propertyValues.TryGetValue(localProperty, out localValue)) { if (localValue != keyValue) { foreignKeys.Remove(foreignKey); foreignKey = null; break; } } } } } if (foreignKey == null) AstoriaTestLog.FailAndThrow("Could not find an appropriate foreign key"); relatedForeignKeys.Add(foreignKey); } for (int i = 0; i < foreignKey.Properties.Length; i++) { NodeProperty p = foreignKey.Properties[i]; if (p.Name == foreignProperty.Name) propertyValues[currentProperty] = foreignKey.Values[i].ClrValue; else if (p.ForeignKeys.Count() > 0) { string foreign = p.ForeignKeys.First().PrimaryKey.Properties.OfType<ResourceProperty>().First().Name; ResourceProperty localProperty; if (reverseForeignKeyMap.TryGetValue(foreign, out localProperty)) propertyValues[localProperty] = foreignKey.Values[i].ClrValue; } } } foreach(ResourceProperty property in resType.Key.Properties.OfType<ResourceProperty>()) if(!propertyValues.ContainsKey(property)) propertyValues[property] = (object)null; foreach (KeyValuePair<ResourceProperty, object> pair in propertyValues) { keyProperties.Add(new ResourceInstanceSimpleProperty(pair.Key.Facets, pair.Key.Name, pair.Value)); } ResourceInstanceKey resourceInstanceKey = new ResourceInstanceKey(container, resType, keyProperties.ToArray()); return resourceInstanceKey; }
internal static ResourceInstanceKey CreateUniqueKey(ResourceContainer container, ResourceType resType, KeyExpressions relatedForeignKeys, KeyExpressions existingKeys) { KeyExpressions possibleRelatedForeignKeys = new KeyExpressions(); Workspace workspace = container.Workspace; int keysGenerated = 0; bool keyTrying = true; ResourceInstanceKey resourceInstanceKey = null; do { possibleRelatedForeignKeys = new KeyExpressions(); resourceInstanceKey = TryCreateUniqueResourceInstanceKey(container, resType, possibleRelatedForeignKeys); KeyExpression keyExpression = resourceInstanceKey.CreateKeyExpression(container, resType); // need to make sure its not a duplicate // if (existingKeys == null) { KeyedResourceInstance o = workspace.GetSingleResourceByKey(keyExpression); if (o == null) keyTrying = false; } else { keyTrying = existingKeys.Contains(keyExpression); } keysGenerated++; if (keysGenerated > 25) throw new Microsoft.Test.ModuleCore.TestFailedException("Unable to create a unique key"); } while (keyTrying); relatedForeignKeys.Add(possibleRelatedForeignKeys); return resourceInstanceKey; }
public ConcurrencyAttribute(ResourceType type, params string[] propertyNames) : this(type, propertyNames.AsEnumerable()) { }
private static List<ResourceInstanceProperty> CloneRequiredRelationships(ResourceContainer container, ResourceType resourceType, KeyExpression keyExpression) { List<ResourceInstanceProperty> properties = new List<ResourceInstanceProperty>(); //Foreach Navigation Property in dataObject create a bind Dictionary<ResourceProperty, KeyExpressions> navigationProperties = GetAllAssociatedKeys(container, resourceType, keyExpression); foreach (ResourceProperty navProperty in navigationProperties.Keys) { //ResourceAssociationEnd otherEnd = navProperty.ResourceAssociation.GetOtherEnd(navProperty); ResourceType navPropertyResourceType = (navProperty.Type is CollectionType ? (navProperty.Type as CollectionType).SubType : navProperty.Type) as ResourceType; ResourceContainer otherContainer = container.FindDefaultRelatedContainer(navProperty); bool foreignKeyViolation = false; foreach (ResourceProperty otherProperty in otherContainer.BaseType.Key.Properties) { if (otherProperty.ForeignKeys.Count() > 0) { ResourceType otherType = otherProperty.ForeignKeys.First().PrimaryKey.Properties.OfType<ResourceProperty>().First().ResourceType; if (otherType == container.BaseType) { foreignKeyViolation = true; break; } } } if (foreignKeyViolation) continue; KeyExpressions keyExpressions = navigationProperties[navProperty]; if (navProperty.Type is ResourceType) { if (keyExpressions.Count > 0) { properties.Add(CreateRefInstanceProperty(keyExpressions[0], otherContainer, navProperty)); } } else { ResourceInstanceProperty property = CreateCollectionInstanceProperty(keyExpressions, otherContainer, navProperty); if (property != null) { properties.Add(property); } } } return properties; }
public static Dictionary<string, string> ParseETag(ResourceType type, string ETag) { string[] values = SplitETag(ETag); List<string> etagProperties = type.Properties.Where(p => p.Facets.ConcurrencyModeFixed).Select(p => p.Name).ToList(); if (values.Length != etagProperties.Count) { AstoriaTestLog.FailAndThrow("Could not parse etag"); return null; } else { Dictionary<string, string> etagMap = new Dictionary<string, string>(); for (int i = 0; i < values.Length; i++) { etagMap[etagProperties[i]] = values[i]; } return etagMap; } }
public static Dictionary<ResourceProperty, KeyExpressions> GetAllAssociatedKeys(ResourceContainer container, ResourceType resourceType, KeyExpression keyExpression) { Workspace workspace = container.Workspace; Dictionary<ResourceProperty, KeyExpressions> listOfKeyExpressions = new Dictionary<ResourceProperty, KeyExpressions>(); foreach (ResourceProperty resourceProperty in resourceType.Properties) { if (resourceProperty.IsNavigation) { KeyExpressions keys = workspace.GetExistingAssociatedKeys(container, resourceProperty, keyExpression); listOfKeyExpressions.Add(resourceProperty, keys); } } return listOfKeyExpressions; }
public static FirstOrDefaultExpression FirstOrDefault(this QueryNode input, ResourceType resourceType) { return new FirstOrDefaultExpression(input, resourceType); }
internal static KeyedResourceInstance CreateKeyedResourceInstanceByExactClone(ResourceContainer container, ResourceType resourceType, object dataObject) { List<ResourceInstanceProperty> properties = new List<ResourceInstanceProperty>(); List<ResourceInstanceProperty> keyProperties = new List<ResourceInstanceProperty>(); properties.AddRange(CloneObjectToResourceInstanceProperties(resourceType.Properties.OfType<ResourceProperty>().Where(rp => rp.PrimaryKey == null && rp.IsNavigation == false), dataObject)); keyProperties.AddRange(CloneObjectToResourceInstanceProperties(resourceType.Properties.OfType<ResourceProperty>().Where(rp => rp.PrimaryKey != null && rp.IsNavigation == false), dataObject)); ResourceInstanceKey key = new ResourceInstanceKey(container, resourceType, keyProperties.ToArray()); KeyedResourceInstance keyResourceInstance = new KeyedResourceInstance(key, properties.ToArray()); return keyResourceInstance; }
private static MemberBindExpression BindProperty(ResourceType resourceType, string LeftHandSide, string RightHandSide) { PropertyExpression sourceProperty = new PropertyExpression(resourceType.Properties[RightHandSide] as ResourceProperty); TypedMemberExpression targetProperty = new TypedMemberExpression(resourceType.ClientClrType, resourceType.Properties[LeftHandSide].Name); return new MemberBindExpression(sourceProperty, targetProperty); }
internal static KeyedResourceInstance CreateKeyedResourceInstanceFromPayloadObject(ResourceContainer container, ResourceType resourceType, PayloadObject payloadObject) { List<ResourceInstanceProperty> properties = new List<ResourceInstanceProperty>(); List<ResourceInstanceProperty> keyProperties = new List<ResourceInstanceProperty>(); foreach (ResourceProperty property in resourceType.Properties.OfType<ResourceProperty>()) { if (property.IsNavigation) continue; if (property.IsComplexType) { PayloadComplexProperty fromPayload = payloadObject[property.Name] as PayloadComplexProperty; properties.Add(ConvertComplexPayloadObjectToComplexProperty(property, fromPayload)); } else { string stringValue; if (payloadObject.PayloadProperties.Any(p => p.Name == property.Name)) { PayloadSimpleProperty fromPayload = payloadObject[property.Name] as PayloadSimpleProperty; stringValue = fromPayload.Value; } else { if (!payloadObject.CustomEpmMappedProperties.TryGetValue(property.Name, out stringValue)) stringValue = null; } ResourceInstanceProperty newProperty = null; object val = CommonPayload.DeserializeStringToObject(stringValue, property.Type.ClrType, false, payloadObject.Format); newProperty = new ResourceInstanceSimpleProperty(property.Name, new NodeValue(val, property.Type)); if (property.PrimaryKey != null) keyProperties.Add(newProperty); else properties.Add(newProperty); } } ResourceInstanceKey key = new ResourceInstanceKey(container, resourceType, keyProperties.ToArray()); return new KeyedResourceInstance(key, properties.ToArray()); }
//Constructor public SingleOrDefaultExpression(QueryNode input, ResourceType resourceType) : base(input) { _resourceType = resourceType; }
public static void Verify(Workspace w, ExpNode q, IEnumerable results, ResourceType resType) { Verify(w, q, results, resType, null, false); }