static void Main(string[] args)
        {
            SomeDTO dto = new SomeDTO();

            var propEnum = dto.GivePropertyEnumerator <bool>("^Arrange");

            propEnum.GetClassAttributes <TableHeaderAttribute>().Any(a =>
            {
                Console.WriteLine("entity has header: " + a.HeaderText);

                return(true);
            });


            var countFalse = (from pvo in propEnum
                              where pvo.Value == false
                              select pvo);

            countFalse.Any(x =>
            {
                if (x.GetAttribute <DisplayAttribute>().Any(a =>
                {
                    Console.WriteLine("Attribute text " + a.Name);

                    return(true);
                }))
                {
                    Console.WriteLine("Found attribute");
                }
                else
                {
                    Console.WriteLine("Didn't find attribute");
                }

                Console.WriteLine(string.Format("{0}: {1}", x.PropertyInfo.Name, x.Value));

                return(false);
            });

            Console.WriteLine("Non authorized count: " + countFalse.Count());

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public SyntaxExample()
        {
            var db = GetDialect();
            var dto = new SomeDTO();

            db.Insert<SomeEntity>()
                .MapFrom(dto);

            db.Update<SomeEntity>()
                .Set(c => c.Value1, dto.Value1)
                .Set(c => c.Value2, dto.Value2)
                .Where(c => c.Id == dto.Id)
                .And(c => c.Value2 == 1)
                .ToCommand();

            db.Update<SomeEntity>()
                .MapFrom(dto)
                .WithId(c => c.Id);

            db.Delete<SomeEntity>()
                .Where(c => c.Id == dto.Id)
                .And(c => c.Value2 == dto.Value2)
                .ToCommand();
        }
 public ActionResult DoWork(SomeDTO dto)
 {
     return(View("Index"));
 }