Пример #1
0
        public static Exporter Create(Guid id, Business business = null, Address address = null, string name = "AnyName")
        {
            var exporter = ObjectInstantiator <Exporter> .CreateNew();

            EntityHelper.SetEntityId(exporter, id);

            if (business == null)
            {
                business = ComplexTypeFactory.Create <Business>();
                ObjectInstantiator <Business> .SetProperty(x => x.Name, name, business);
            }

            if (address == null)
            {
                address = ComplexTypeFactory.Create <Address>();
            }

            ObjectInstantiator <Exporter> .SetProperty(x => x.Business, business, exporter);

            ObjectInstantiator <Exporter> .SetProperty(x => x.Address, address, exporter);

            ObjectInstantiator <Exporter> .SetProperty(x => x.Contact, ComplexTypeFactory.Create <Contact>(), exporter);

            return(exporter);
        }
Пример #2
0
        public static Importer Create(Guid notiificationId, Guid id, Business business = null, Address address = null, string name = "AnyName")
        {
            if (business == null)
            {
                business = ComplexTypeFactory.Create <Business>();
                ObjectInstantiator <Business> .SetProperty(x => x.Name, name, business);
            }

            if (address == null)
            {
                address = ComplexTypeFactory.Create <Address>();
            }

            var importer = new Importer(notiificationId, address, business, ComplexTypeFactory.Create <Contact>());

            EntityHelper.SetEntityId(importer, id);

            return(importer);
        }