예제 #1
0
        public static IApplicationBuilder UseTypeContainer(this IApplicationBuilder builder)
        {
            foreach (var tc in TypeContainer.Initialize(Assembly.GetAssembly(typeof(A4AModel1)).GetTypes().Where(x => x.Name.StartsWith("A4A") && x.Name.EndsWith("ViewModel"))))
            {
                tc.
                FirstPropertyIsPrimaryKey().
                SetDelegateForCreateInstance().
                AddProperties(x => x.PropertyType == typeof(String) || !typeof(IEnumerable).IsAssignableFrom(x.PropertyType));
            }


            foreach (var tc in TypeContainer.Initialize(Assembly.GetAssembly(typeof(A4ACategory)).GetTypes()
                                                        .Where(predicate: x => x.IsClass && typeof(IMessage).IsAssignableFrom(x))))
            {
                tc
                .FirstPropertyIsPrimaryKey()
                .SetDelegateForCreateInstance()
                .AddProperties(x =>
                               x.PropertyType == typeof(String) || !typeof(IEnumerable).IsAssignableFrom(x.PropertyType));
            }
            return(builder);
        }