예제 #1
0
        public void Initialize(IComponentConfigurator componentConfigurator)
        {
            if (componentConfigurator == null)
            {
                throw new ArgumentNullException(nameof(componentConfigurator));
            }

            componentConfigurator.WithMappingsProvidedBy <FluentMappingSourceProvider>();
            componentConfigurator.WithComponent <DefaultMappingsRepository, DefaultMappingsRepository>();
            componentConfigurator.WithComponent <IMappingsRepository, EntityAwareMappingsRepository>(
                Lifestyle.BoundToEntityContext,
                (container, mappingsRepository) =>
            {
                var context = container.Resolve <IEntityContext>();
                EntityContextExtensions.ExplicitMappings[context] = new DefaultExplicitMappings();
                if (EntityContextExtensions.ConverterProvider == null)
                {
                    EntityContextExtensions.ConverterProvider = container.Resolve <IConverterProvider>();
                    EntityContextExtensions.MappingVisitors   = container.Resolve <IEnumerable <IMappingProviderVisitor> >();
                    EntityContextExtensions.QIriMappings      = container.Resolve <IEnumerable <QIriMapping> >();
                }

                context.Disposed += (sender, args) => EntityContextExtensions.ExplicitMappings.Remove(context);
            });
        }
예제 #2
0
        public void Initialize(IComponentConfigurator componentConfigurator)
        {
            if (componentConfigurator == null)
            {
                throw new ArgumentNullException(nameof(componentConfigurator));
            }

            componentConfigurator.WithComponent <IChangeDetector, DefaultChangeDetector>(Lifestyle.BoundToEntityContext);
            componentConfigurator.WithComponent <IConverterProvider, DefaultConverterProvider>();
            componentConfigurator.WithInstance(new QIriMapping("xsd", xsd.Namespace), "xsd");
            componentConfigurator.WithInstance(new QIriMapping("rdf", rdf.Namespace), "rdf");
            componentConfigurator.WithInstance(new QIriMapping("rdfs", rdfs.Namespace), "rdfs");
            componentConfigurator.WithInstance(new QIriMapping("owl", owl.Namespace), "owl");
            componentConfigurator.WithInstance(new QIriMapping("oguid", oguid.Namespace), "oguid");
        }