示例#1
0
 private void InstantiateObjects(ISession session)
 {
     this.contact = (Person)session.Instantiate(this.contact);
     this.partner = (Organisation)session.Instantiate(this.partner);
     this.internalOrganisation = (InternalOrganisation)session.Instantiate(this.internalOrganisation);
     this.contactRelationship = (OrganisationContactRelationship)session.Instantiate(this.contactRelationship);
     this.partnership = (Partnership)session.Instantiate(this.partnership);
 }
示例#2
0
        public override void Init()
        {
            base.Init();

            this.contact = new PersonBuilder(this.DatabaseSession).WithLastName("contact").Build();
            this.partner = new OrganisationBuilder(this.DatabaseSession).WithName("partner").WithLocale(new Locales(this.DatabaseSession).EnglishGreatBritain).Build();
            this.internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");

            this.partnership = new PartnershipBuilder(this.DatabaseSession)
                .WithPartner(this.partner)
                .WithInternalOrganisation(this.internalOrganisation)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            this.contactRelationship = new OrganisationContactRelationshipBuilder(this.DatabaseSession)
                .WithOrganisation(this.partner)
                .WithContact(this.contact)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();
        }