Example #1
0
        public void Apply(ITypeConventionContext context)
        {
            // Register every public property on this type
            foreach (var property in context.Target
                     .GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
                     .Where(x => !x.PropertyType.ContainsGenericParameters && IsDefinedOnType(x, context.Target)))
            {
                if (PropertyHasPublicSetter(property))
                {
                    context.RegisterProperty(property);
                }
            }

            // Register every public field on this type
            foreach (var field in context.Target
                     .GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
                     .Where(x => !x.FieldType.ContainsGenericParameters && IsDefinedOnType(x, context.Target)))
            {
                context.RegisterField(field);
            }
        }
        public void Apply(ITypeConventionContext context)
        {
            // Register every public property on this type
            foreach(var property in context.Target
                .GetProperties( System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
                .Where(x => !x.PropertyType.ContainsGenericParameters && IsDefinedOnType(x, context.Target)))
            {
                if(PropertyHasPublicSetter(property))
                {
                    context.RegisterProperty(property);
                }
            }

            // Register every public field on this type
            foreach (var field in context.Target
                .GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
                .Where(x => !x.FieldType.ContainsGenericParameters && IsDefinedOnType(x, context.Target)))
            {
                context.RegisterField(field);
            }
        }
 public void Apply(ITypeConventionContext context)
 {
     context.RegisterProperty(typeof(TestType).GetProperty("TestProperty"));
     context.RegisterField(typeof(TestType).GetField("TestField"));
 }
 public void Apply(ITypeConventionContext context)
 {
     context.RegisterProperty(typeof(TestType).GetProperty("TestProperty"));
     context.RegisterField(typeof(TestType).GetField("TestField"));
 }
 public void Apply(ITypeConventionContext context)
 {
     context.RegisterField(typeof(TestTypeClass).GetField("Test"));
 }
 public void Apply(ITypeConventionContext context)
 {
     context.RegisterField(typeof(TestTypeClass).GetField("Test"));
 }