Example #1
0
        public EntityContext(
            IEntityContextFactory factory,
            IMappingsRepository mappings,
            IEntityStore entityStore,
            IEntitySource entitySource,
            IBaseUriSelectionPolicy baseUriSelector,
            IRdfTypeCache typeCache,
            IBlankNodeIdGenerator blankIdGenerator,
            IResultTransformerCatalog transformerCatalog,
            IEntityCaster caster,
            IDatasetChangesTracker changeTracker,
            IResourceResolutionStrategy resourceResolutionStrategy,
            ILogger log)
            : this(changeTracker)
        {
            _factory                    = factory;
            _entityStore                = entityStore;
            _entitySource               = entitySource;
            _baseUriSelector            = baseUriSelector;
            _mappings                   = mappings;
            _typeCache                  = typeCache;
            _blankIdGenerator           = blankIdGenerator;
            _transformerCatalog         = transformerCatalog;
            _caster                     = caster;
            _typedEntityMapping         = _mappings.MappingFor <ITypedEntity>();
            _typesPropertyMapping       = _typedEntityMapping.PropertyFor("Types");
            _resourceResolutionStrategy = resourceResolutionStrategy;
            _log = log;

            if (_baseUriSelector == null)
            {
                _log.Warning("No Base URI Selection Policy. It will not be possible to use relative URIs");
            }
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserFactory" /> class.
 /// </summary>
 /// <param name="statusChecker">The status checker.</param>
 /// <param name="passwordValidator">The password validator.</param>
 /// <param name="symmetricKeyStore">The symmetric key store.</param>
 /// <param name="entityContextFactory">The entity context factory.</param>
 public UserFactory(IMembershipStatusChecker statusChecker, IPasswordValidator passwordValidator, ISymmetricKeyStore symmetricKeyStore, IEntityContextFactory entityContextFactory)
 {
     _statusChecker = statusChecker;
     _passwordValidator = passwordValidator;
     _symmetricKeyStore = symmetricKeyStore;
     _entityContextFactory = entityContextFactory;
 }
Example #3
0
 public EntityContext(
     IEntityContextFactory factory,
     IMappingsRepository mappings,
     IEntityStore entityStore,
     IEntitySource entitySource,
     IBaseUriSelectionPolicy baseUriSelector,
     IRdfTypeCache typeCache,
     IBlankNodeIdGenerator blankIdGenerator,
     IResultTransformerCatalog transformerCatalog,
     IEntityCaster caster,
     IDatasetChangesTracker changeTracker,
     ILogger log)
     : this(
         factory,
         mappings,
         entityStore,
         entitySource,
         baseUriSelector,
         typeCache,
         blankIdGenerator,
         transformerCatalog,
         caster,
         changeTracker,
         null,
         log)
 {
 }
 protected void Setup()
 {
     _factory = new EntityContextFactory()
                .WithOntology(new DefaultOntologiesProvider())
                .WithOntology(new IntegrationTestsBase.LifeOntology())
                .WithOntology(new TestOntologyProvider(false))
                .WithOntology(new IntegrationTestsBase.ChemOntology())
                .WithMappings(builder => builder.FromAssemblyOf <ISomeEntity>());
 }
        public void Setup()
        {
            Mappings = SetupMappings();
            _entityStore = new EntityStore();

            _factory = new EntityContextFactory().WithEntitySource(CreateEntitySource)
                                               .WithOntology(new DefaultOntologiesProvider())
                                               .WithOntology(new LifeOntology())
                                               .WithOntology(new TestOntologyProvider(IncludeFoaf))
                                               .WithOntology(new ChemOntology())
                                               .WithMappings(BuildMappings)
                                               .WithMetaGraphUri(MetaGraphUri)
                                               .WithEntityStore(() => _entityStore);
            ChildSetup();
        }
Example #6
0
        public JobContainer(
            ILogger logger,
            IEntityContextFactory contextFactory,
            IPlatformModuleEntities platformModuleEntities)
        {
            _logger = logger;
            _logger.Init(GetType());

            _internalSequence = 0;

            _jobs = new Dictionary <string, Job>();

            _contextFactory = contextFactory;

            LoadPersistedJobs(platformModuleEntities);
        }
        protected WorkflowFactoryBase(IEntityContextFactory contextFactory, ILogger logger)
        {
            _logger         = logger;
            _contextFactory = contextFactory;

            lock (_locking)
            {
                if (_recipeItemId == 0)
                {
                    using (var context = _contextFactory.CreateContext())
                    {
                        var recipeItems = context.GetQuery <RouteItem>();
                        _recipeItemId = recipeItems.Any() ? recipeItems.Max(a => a.Id) : 1;
                        context.SaveChanges();
                    }
                }
            }
        }
Example #8
0
        /// <summary>
        /// Determines whether the Event has a unique DirectUrl.
        /// </summary>
        /// <param name="entity">The event.</param>
        /// <param name="entitytContextFactory">The object context factory.</param>
        /// <returns>
        /// 	<c>true</c> if the Event has a unique DirectUrl; otherwise, <c>false</c>.
        /// </returns>
        public static bool HasUniqueDirectUrl(Event entity, IEntityContextFactory entitytContextFactory)
        {
            bool result;

            using (var context = entitytContextFactory.CreateEntityContext())
            {
                var count = context.EntitySet<Event>().Count(e => e.DirectUrl == entity.DirectUrl && e.Id != entity.Id);
                if (count > 0)
                {
                    throw new BusinessException(
                        string.Format(CultureInfo.CurrentCulture,
                                        "There is already an Event with a direct url of \"{0}\".",
                                        entity.DirectUrl));
                }
                result = true;
            }

            return result;
        }
Example #9
0
        public void Setup()
        {
            Mappings = SetupMappings();

            _container = new ServiceContainer();
            _store     = CreateTripleStore();
            EntityContextFactory factory = new EntityContextFactory(_container)
                                           .WithOntology(new DefaultOntologiesProvider())
                                           .WithOntology(new LifeOntology())
                                           .WithOntology(new TestOntologyProvider(IncludeFoaf))
                                           .WithOntology(new ChemOntology())
                                           .WithMappings(BuildMappings)
                                           .WithMetaGraphUri(MetaGraphUri)
                                           .WithDotNetRDF(_store)
                                           .WithBaseUri(b => b.Default.Is(new Uri("http://example.com/")));

            factory.ThreadSafe   = ThreadSafe;
            factory.TrackChanges = TrackChanges;
            _factory             = factory;
            ChildSetup();
        }
Example #10
0
 public WeatherForecastGetterRepository(IEntityContextFactory entityContextFactory)
 {
     _entityContextFactory = entityContextFactory;
 }
 public EncryptedSettingsManager(IEntityContextFactory entityContextFactory, IOrgUnitContextStorage orgUnitContextStorage, ISymmetricKeyStore symmetricKeyStore)
     : base(entityContextFactory, orgUnitContextStorage)
 {
     _symmetricKeyStore = symmetricKeyStore;
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExternalIdHelper" /> class.
 /// </summary>
 /// <param name="entityContextFactory">The entity context factory.</param>
 public ExternalIdHelper(IEntityContextFactory entityContextFactory)
 {
     _entityContextFactory = entityContextFactory;
 }
Example #13
0
 /// <summary>
 /// Create a new instance of <see cref="UnitOfWork"/>
 /// </summary>
 public UnitOfWork(IEntityContextFactory entityContextFactory, IRepositoryProvider repoProvider)
 {
     EntityContextFactory = entityContextFactory;
     RepoProvider         = repoProvider;
 }
 public EmailTemplateHelper(IEntityContextFactory entityContextFactory)
 {
     _entityContextFactory = entityContextFactory;
 }
Example #15
0
 /// <summary>Initializes a new instance of the <see cref="ExpressionTreeConverter"/> class.</summary>
 /// <param name="uriParsers">The URI parsers.</param>
 /// <param name="entityContextFactory">Entity context factory.</param>
 public ExpressionTreeConverter(IEnumerable <IUriParser> uriParsers, IEntityContextFactory entityContextFactory)
 {
     _uriParsers           = uriParsers;
     _entityContextFactory = entityContextFactory;
 }
Example #16
0
 /// <summary>
 /// Create a new instance of <see cref="UnitOfWorkFactory"/>
 /// </summary>
 public UnitOfWorkFactory(IRepositoryProvider repositoryProvider, IEntityContextFactory entityContextFactory)
 {
     RepositoryProvider   = repositoryProvider;
     EntityContextFactory = entityContextFactory;
 }
 public PatientRatingsHelper(IPatientRatingsSettingsStore settings, IEntityContextFactory entityContext)
 {
     _settings = settings.Read();
     _objectContext = entityContext.CreateEntityContext().ObjectContext;
 }
Example #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StaffProfileHelper" /> class.
 /// </summary>
 /// <param name="entityContextFactory">The object context factory.</param>
 /// <param name="userFactory">The user factory.</param>
 public StaffProfileHelper(IEntityContextFactory entityContextFactory, IUserFactory userFactory)
 {
     _entityContextFactory = entityContextFactory;
     _userFactory = userFactory;
 }
Example #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PasswordValidator" /> class.
 /// </summary>
 /// <param name="entityContextFactory">The entity context factory.</param>
 public PasswordValidator(IEntityContextFactory entityContextFactory)
 {
     _entityContextFactory = entityContextFactory;
 }
 protected MosaicSampleWorkflowFactory(IEntityContextFactory contextFactory, ILogger logger) : base(contextFactory, logger)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MembershipStatusChecker" /> class.
 /// </summary>
 /// <param name="entityContextFactory">The entity context factory.</param>
 public MembershipStatusChecker(IEntityContextFactory entityContextFactory)
 {
     _entityContextFactory = entityContextFactory;
 }
 public BarService(IEntityContextFactory entityContextFactory)
 {
     _entityContextFactory = entityContextFactory;
 }
Example #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StaffOrgUnitHelper" /> class.
 /// </summary>
 /// <param name="entityContextFactory">The object context factory.</param>
 public StaffOrgUnitHelper(IEntityContextFactory entityContextFactory)
 {
     _entityContextFactory = entityContextFactory;
 }
 public override void SetUp()
 {
     base.SetUp();
     _entityContectFactory = new TestEntityContextFactory(ConnectionStrings.TestDatabase);
 }
Example #25
0
 public SettingsManager(IEntityContextFactory entityContextFactory, IOrgUnitContextStorage orgUnitContextStorage)
 {
     _entityContextFactory = entityContextFactory;
     _orgUnitContextStorage = orgUnitContextStorage;
 }