Ejemplo n.º 1
0
        private void TestDomainTransforming()
        {
            var domain = new Domain(PostgresReference);
            var foo = domain.AddEntityType<IFoo>();

            var dtos = domain
                .Transform(model => true, new Transformation<EntityModel>()
                    .Set(
                        model => model.Properties,
                        model => model.Properties.Select(propModel => propModel.Type == typeof(Type)
                            ? propModel
                            : propModel.Set(m => m.Type, typeof(string)).Apply()).ToList())
                    .Set(
                        model => model.Name,
                        model => model.Name.TrimStart('I') + "Dto")
                );

            foo = foo.Set(model => model.Name, "Foo").Apply();
            if (foo.Name != "Foo")
            {
                throw new Exception();
            }
        }