private void EnsureReflectionObject(Type t) { if (this._reflectionObject == null) { this._reflectionObject = ReflectionObject.Create(t, t.GetConstructor(new Type[] { typeof(byte[]) }), new string[] { "ToArray" }); } }
private static void EnsureReflectionObject(Type objectType) { if (EntityKeyMemberConverter._reflectionObject == null) { EntityKeyMemberConverter._reflectionObject = ReflectionObject.Create(objectType, new string[] { "Key", "Value" }); } }
private static Type GetAssociateMetadataTypeFromAttribute(Type type) { object[] customAttributes; #if !PORTABLE customAttributes = type.GetCustomAttributes(false); #else customAttributes = type.GetTypeInfo().GetCustomAttributes(false).Cast <object>().ToArray(); #endif foreach (var attribute in customAttributes) { Type attributeType = attribute.GetType(); // only test on attribute type name // attribute assembly could change because of type forwarding, etc if (string.Equals(attributeType.FullName, "System.ComponentModel.DataAnnotations.MetadataTypeAttribute", StringComparison.Ordinal)) { const string metadataClassTypeName = "MetadataClassType"; if (_metadataTypeAttributeReflectionObject == null) { _metadataTypeAttributeReflectionObject = ReflectionObject.Create(attributeType, metadataClassTypeName); } return((Type)_metadataTypeAttributeReflectionObject.GetValue(attribute, metadataClassTypeName)); } } return(null); }
private static Type GetAssociateMetadataTypeFromAttribute(Type type) { object[] customAttributes; #if !PORTABLE customAttributes = type.GetCustomAttributes(false); #else customAttributes = type.GetTypeInfo().GetCustomAttributes(false).Cast <object>().ToArray(); #endif foreach (var attribute in customAttributes) { Type attributeType = attribute.GetType(); if (string.Equals(attributeType.Name, "MetadataTypeAttribute", StringComparison.Ordinal) && attributeType.Assembly().FullName.StartsWith("System.ComponentModel.DataAnnotations", StringComparison.Ordinal)) { const string metadataClassTypeName = "MetadataClassType"; if (_metadataTypeAttributeReflectionObject == null) { _metadataTypeAttributeReflectionObject = ReflectionObject.Create(attributeType, metadataClassTypeName); } return((Type)_metadataTypeAttributeReflectionObject.GetValue(attribute, metadataClassTypeName)); } } return(null); }
private static void EnsureReflectionObject(Type t) { if (BinaryConverter._reflectionObject == null) { BinaryConverter._reflectionObject = ReflectionObject.Create(t, t.GetConstructor(new Type[] { typeof(byte[]) }), new string[] { "ToArray" }); } }
private void EnsureReflectionObject(Type t) { if (_reflectionObject == null) { _reflectionObject = ReflectionObject.Create(t, t.GetConstructor(new[] { typeof(byte[]) }), BinaryToArrayName); } }
private static Type GetAssociateMetadataTypeFromAttribute(Type type) { Attribute[] customAttributes = ReflectionUtils.GetAttributes(type, null, true); foreach (Attribute attribute in customAttributes) { Type attributeType = attribute.GetType(); // only test on attribute type name // attribute assembly could change because of type forwarding, etc if (string.Equals(attributeType.FullName, "System.ComponentModel.DataAnnotations.MetadataTypeAttribute", StringComparison.Ordinal)) { const string metadataClassTypeName = "MetadataClassType"; if (_metadataTypeAttributeReflectionObject == null) { _metadataTypeAttributeReflectionObject = ReflectionObject.Create(attributeType, metadataClassTypeName); } return((Type)_metadataTypeAttributeReflectionObject.GetValue(attribute, metadataClassTypeName)); } } return(null); }
private static Type GetAssociateMetadataTypeFromAttribute(Type type) { Type metadataTypeAttributeType = GetMetadataTypeAttributeType(); if (metadataTypeAttributeType == null) { return(null); } Attribute attribute = ReflectionUtils.GetAttributes(type, metadataTypeAttributeType, true).SingleOrDefault(); if (attribute == null) { return(null); } const string metadataClassTypeName = "MetadataClassType"; if (_metadataTypeAttributeReflectionObject == null) { _metadataTypeAttributeReflectionObject = ReflectionObject.Create(metadataTypeAttributeType, metadataClassTypeName); } return((Type)_metadataTypeAttributeReflectionObject.GetValue(attribute, metadataClassTypeName)); }
private static void EnsureReflectionObject(Type objectType) { if (_reflectionObject == null) { _reflectionObject = ReflectionObject.Create(objectType, KeyPropertyName, ValuePropertyName); } }
private static void EnsureReflectionObject(Type objectType) { if (_reflectionObject == null) { string[] memberNames = new string[] { "Key", "Value" }; _reflectionObject = ReflectionObject.Create(objectType, memberNames); } }
private static ReflectionObject InitializeReflectionObject(Type t) { Type[] genericArguments = t.GetGenericArguments(); Type item = ((IList <Type>)genericArguments)[0]; Type type = ((IList <Type>)genericArguments)[1]; return(ReflectionObject.Create(t, t.GetConstructor(new Type[] { item, type }), new string[] { "Key", "Value" })); }
private static ReflectionObject InitializeReflectionObject(Type t) { IList <Type> genericArguments = t.GetGenericArguments(); Type keyType = genericArguments[0]; Type valueType = genericArguments[1]; return(ReflectionObject.Create(t, t.GetConstructor(new[] { keyType, valueType }), KeyName, ValueName)); }
private void EnsureReflectionObject(Type t) { if (this._reflectionObject == null) { Type[] types = new Type[] { typeof(byte[]) }; string[] memberNames = new string[] { "ToArray" }; this._reflectionObject = ReflectionObject.Create(t, t.GetConstructor(types), memberNames); } }
private static ReflectionObject InitializeReflectionObject(Type t) { Type[] genericArguments = t.GetGenericArguments(); Type type = genericArguments[0]; Type type2 = genericArguments[1]; Type[] types = new Type[] { type, type2 }; string[] memberNames = new string[] { "Key", "Value" }; return(ReflectionObject.Create(t, t.GetConstructor(types), memberNames)); }
private void EnsureReflectionObject(Type t) { if (this._reflectionObject != null) { return; } this._reflectionObject = ReflectionObject.Create(t, (MethodBase)t.GetConstructor(new Type[1] { typeof(byte[]) }), "ToArray"); }
private static ReflectionObject InitializeReflectionObject(Type t) { Type[] genericArguments = t.GetGenericArguments(); Type type1 = ((IList <Type>)genericArguments)[0]; Type type2 = ((IList <Type>)genericArguments)[1]; return(ReflectionObject.Create(t, (MethodBase)t.GetConstructor(new Type[2] { type1, type2 }), "Key", "Value")); }
private void EnsureReflectionObject(Type t) { if (_reflectionObject == null) { #if NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 _reflectionObject = ReflectionObject.Create(t, System.Reflection.TypeExtensions.GetConstructor(t, new[] { typeof(byte[]) }), BinaryToArrayName); #else _reflectionObject = ReflectionObject.Create(t, t.GetConstructor(new[] { typeof(byte[]) }), BinaryToArrayName); #endif } }
private static Type GetAssociateMetadataTypeFromAttribute(Type type) { foreach (Attribute attribute in ReflectionUtils.GetAttributes((object)type, (Type)null, true)) { Type type1 = attribute.GetType(); if (string.Equals(type1.FullName, "System.ComponentModel.DataAnnotations.MetadataTypeAttribute", StringComparison.Ordinal)) { if (JsonTypeReflector._metadataTypeAttributeReflectionObject == null) { JsonTypeReflector._metadataTypeAttributeReflectionObject = ReflectionObject.Create(type1, "MetadataClassType"); } return((Type)JsonTypeReflector._metadataTypeAttributeReflectionObject.GetValue((object)attribute, "MetadataClassType")); } } return((Type)null); }
private static Type GetAssociateMetadataTypeFromAttribute(Type type) { foreach (Attribute attribute in ReflectionUtils.GetAttributes(type, null, true)) { Type t = attribute.GetType(); if (string.Equals(t.FullName, "System.ComponentModel.DataAnnotations.MetadataTypeAttribute", StringComparison.Ordinal)) { if (_metadataTypeAttributeReflectionObject == null) { string[] memberNames = new string[] { "MetadataClassType" }; _metadataTypeAttributeReflectionObject = ReflectionObject.Create(t, memberNames); } return((Type)_metadataTypeAttributeReflectionObject.GetValue(attribute, "MetadataClassType")); } } return(null); }
private static Type GetAssociateMetadataTypeFromAttribute(Type type) { Attribute[] attributes = ReflectionUtils.GetAttributes(type, null, true); for (int i = 0; i < (int)attributes.Length; i++) { Attribute attribute = attributes[i]; Type type1 = attribute.GetType(); if (string.Equals(type1.FullName, "System.ComponentModel.DataAnnotations.MetadataTypeAttribute", StringComparison.Ordinal)) { if (JsonTypeReflector._metadataTypeAttributeReflectionObject == null) { JsonTypeReflector._metadataTypeAttributeReflectionObject = ReflectionObject.Create(type1, new string[] { "MetadataClassType" }); } return((Type)JsonTypeReflector._metadataTypeAttributeReflectionObject.GetValue(attribute, "MetadataClassType")); } } return(null); }