// This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var sessionFactory = NHibernateExtensions.GetService(Configuration.GetConnectionString("Default"));

            services.AddSingleton(sessionFactory);
            services.AddScoped(factory => sessionFactory.OpenSession());
            services.AddScoped <IUnitOfWork, UnitOfWork>();
            services.AddScoped <PropertyOwnerService>();
            services.AddControllers();
        }
Exemplo n.º 2
0
        public static TeamDto AssembleDto(this Com.BinaryBracket.BowlsResults.Common.Domain.Entities.Team team)
        {
            var dto = new TeamDto
            {
                ID       = team.ID,
                Name     = team.Name,
                Suffix   = team.Suffix,
                Gender   = team.GenderID,
                AgeGroup = team.AgeGroupID
            };

            if (team.Captain != null)
            {
                var captain = NHibernateExtensions.CastEntity <Contact>(team.Captain);
                dto.Captain = ContactDtoAssembler.AssembleDto(captain);
            }

            return(dto);
        }