Example #1
0
 public ClassPropertyWriter(PropertyAnalysis property)
 {
     this.valueTypeInfo = (TraceLoggingTypeInfo <ValueType>)property.typeInfo;
     this.getter        = (Getter)Statics.CreateDelegate(
         typeof(Getter),
         property.getterInfo);
 }
Example #2
0
        public static PropertyAccessor <ContainerType> Create(PropertyAnalysis property)
        {
            // Due to current Project N limitations on handling generic instantiations with
            // 2 generic parameters we have to explicitly create the instantiations that we consider
            // important to EventSource performance (we have considered int, long, string for the moment).
            // Everything else is handled by NonGenericPropertyWriter that ends up boxing the container object.
            var retType = property.getterInfo.ReturnType;

            if (!Statics.IsValueType(typeof(ContainerType)))
            {
                if (retType == typeof(int))
                {
                    return(new ClassPropertyWriter <ContainerType, int>(property));
                }
                else if (retType == typeof(long))
                {
                    return(new ClassPropertyWriter <ContainerType, long>(property));
                }
                else if (retType == typeof(string))
                {
                    return(new ClassPropertyWriter <ContainerType, string>(property));
                }
            }
            else
            {
                // Handle the case if it is a struct (DD 1027919)
            }

            // Otherwise use the boxing one.
            return(new NonGenericProperytWriter <ContainerType>(property));
        }
Example #3
0
        public static PropertyAccessor <ContainerType> Create(PropertyAnalysis property)
        {
            Type returnType = property.getterInfo.ReturnType;

            if (!Statics.IsValueType(typeof(ContainerType)))
            {
                if (returnType == typeof(int))
                {
                    return((PropertyAccessor <ContainerType>) new ClassPropertyWriter <ContainerType, int>(property));
                }
                if (returnType == typeof(long))
                {
                    return((PropertyAccessor <ContainerType>) new ClassPropertyWriter <ContainerType, long>(property));
                }
                if (returnType == typeof(string))
                {
                    return((PropertyAccessor <ContainerType>) new ClassPropertyWriter <ContainerType, string>(property));
                }
            }
            return((PropertyAccessor <ContainerType>) new NonGenericProperytWriter <ContainerType>(property));
        }
Example #4
0
 public NonGenericProperytWriter(PropertyAnalysis property)
 {
     getterInfo = property.getterInfo;
     typeInfo   = property.typeInfo;
 }
Example #5
0
 public StructPropertyWriter(PropertyAnalysis property)
 {
     this.valueTypeInfo = (TraceLoggingTypeInfo <ValueType>)property.typeInfo;
     this.getter        = (StructPropertyWriter <ContainerType, ValueType> .Getter)Statics.CreateDelegate(typeof(StructPropertyWriter <ContainerType, ValueType> .Getter), property.getterInfo);
 }