<commit_before>﻿using ArchitectNow.Mongo.Models;
using ArchitectNow.Mongo.Options;
using ArchitectNow.Mongo.Services;
using ArchitectNow.Services.Contexts;
using Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;

namespace ArchitectNow.Mongo
{
	public class MongoModule: Module
    {
	    protected override void Load(ContainerBuilder builder)
	    {
		    builder.RegisterAssemblyTypes(ThisAssembly).AsImplementedInterfaces();

		    builder.RegisterGeneric(typeof(MongoDataContextService)).As<IDataContextService<MongoDataContext>>()
			    .InstancePerLifetimeScope();
			
		    builder.Register(context =>
		    {
			    var configurationRoot = context.Resolve<IConfigurationRoot>();
			    var mongoOptions = configurationRoot.GetSection("mongo").Get<MongoOptions>();
				
			    return new OptionsWrapper<MongoOptions>(mongoOptions);
		    }).As<IOptions<MongoOptions>>().SingleInstance();
		}
    }
}<commit_msg>Fixed registration<commit_after>﻿using ArchitectNow.Models.Options;
using ArchitectNow.Mongo.Models;
using ArchitectNow.Mongo.Options;
using ArchitectNow.Mongo.Services;
using ArchitectNow.Services.Contexts;
using Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;

namespace ArchitectNow.Mongo
{
	public class MongoModule: Module
    {
	    protected override void Load(ContainerBuilder builder)
	    {
		    builder.RegisterAssemblyTypes(ThisAssembly).AsImplementedInterfaces();

		    builder.RegisterType<MongoDataContextService>().As<IDataContextService<MongoDataContext>>()
			    .InstancePerLifetimeScope();
			
		    builder.Register(context => context.Resolve<IConfigurationRoot>().CreateOptions<MongoOptions>("mongo")).As<IOptions<MongoOptions>>().SingleInstance();
		}
    }
}
{'fraction_non_alphanumeric': 0.10393258426966293, 'fraction_numerical': 0.0, 'mean_word_length': 5.383512544802867, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2872675', 'n_tokens_mistral': 517, 'n_tokens_neox': 467, 'n_words': 72}