/// <summary>
 /// Gets the document Id.
 /// </summary>
 /// <param name="document">The document.</param>
 /// <param name="id">The Id.</param>
 /// <param name="idGenerator">The IdGenerator for the Id type.</param>
 /// <returns>True if the document has an Id.</returns>
 public virtual bool GetDocumentId(
     object document,
     out object id,
     out IIdGenerator idGenerator
 ) {
     throw new InvalidOperationException("Subclass must implement GetDocumentId");
 }
        public SetupModule(IAggregateRootRepository repository,
                           IAccountRepository accountRepository,
                           IIdGenerator idGenerator)
            :base("/setup")
        {
            Get["/"] = _ =>
            {
                if (accountRepository.Count() > 0)
                    return HttpStatusCode.NotFound;

                return View["Index"];
            };

            Post["/"] = _ =>
            {
                var model = this.Bind<CreateModel>();

                if (accountRepository.Count() > 0)
                    return HttpStatusCode.NotFound;

                var account = new Domain.Account(idGenerator.NextGuid(),
                    model.Name, model.FirstName, model.LastName, model.Email);

                account.ChangePassword(model.Password);
                account.MakeAdmin();

                repository.Save(account);

                return Response.AsRedirect("/");
            };
        }
 public void Init()
 {
     _repoCreator = A.Fake<INodeRepoCreator>();
     _idGenerator = new IdGenerator (_repoCreator);
     _idRepoService= A.Fake<INeo4NodeRepository<IdGeneratorNode>>();
     A.CallTo(() => _repoCreator.CreateNode<IdGroupNodeRelationship, IdReferenceNode, IdGeneratorNode>("",typeof(IdGeneratorRefNodeRelationship))).Returns(_idRepoService);
 }
Example #4
0
 public RedirectionController(IRepository repository, IIdGenerator idGenerator, IBase58Converter base58Converter, IAdminCodeGenerator adminCodeGenerator)
 {
     _repository = repository;
     _idGenerator = idGenerator;
     _base58Converter = base58Converter;
     _adminCodeGenerator = adminCodeGenerator;
 }
Example #5
0
 /// <summary>
 /// GetDocumentId is an invalid operation for wrapper classes.
 /// </summary>
 /// <param name="id">Not applicable.</param>
 /// <param name="idGenerator">Not applicable.</param>
 /// <returns>Not applicable.</returns>
 public bool GetDocumentId(
     out object id,
     out IIdGenerator idGenerator
 ) {
     var message = string.Format("GetDocumentId method cannot be called on a {0}", this.GetType().Name);
     throw new InvalidOperationException(message);
 }
        private Func<RogerEndpoint, IBasicProperties> CreatePropertiesFactory(IModel model,
            IIdGenerator idGenerator,
            IMessageTypeResolver messageTypeResolver,
            IMessageSerializer serializer,
            ISequenceGenerator sequenceGenerator)
        {
            var properties = model.CreateBasicProperties();

            properties.MessageId = idGenerator.Next();
            properties.Type = messageTypeResolver.Unresolve(messageType);
            properties.ContentType = serializer.ContentType;

            properties.Headers = new Hashtable
            {
                {Headers.Sequence, BitConverter.GetBytes(sequenceGenerator.Next(messageType))}
            };

            if (persistent)
                properties.DeliveryMode = 2;

            FillAdditionalProperties(properties, idGenerator);

            return endpoint =>
            {
                properties.ReplyTo = endpoint;
                return properties;
            };
        }
 bool IBsonSerializable.GetDocumentId(
     out object id,
     out IIdGenerator idGenerator
 )
 {
     throw new InvalidOperationException();
 }
Example #8
0
 public bool GetDocumentId(object document, out object id, out Type idNominalType, out IIdGenerator idGenerator)
 {
     id = null;
     idGenerator = null;
     idNominalType = null;
     return false;
 }
Example #9
0
        public StatsModule(ITemplate tmpl, IIdGenerator idgen, SavegameStorage storage)
        {
            Post["/games"] = _ =>
            {
                // Get the temporary location of the file on the server
                var file = Request.Headers["X-FILE"].FirstOrDefault();

                // Get the extension of the file when it was uploaded as the
                // temporary file doesn't have an extension
                var extension = Request.Headers["X-FILE-EXTENSION"].FirstOrDefault();
                if (file == null)
                    throw new ArgumentException("File can't be null");
                if (extension == null)
                    throw new ArgumentException("File extension can't be null");

                Save savegame;
                using (var stream = getStream(file, extension))
                using (parsingTimer.NewContext())
                    savegame = new Save(stream);

                // Turn the savegame into html and return the url for it
                var stats = statsTimer.Time(() => Aggregate(savegame));
                string contents = templateTimer.Time(() => tmpl.Render(stats));
                string id = idgen.NextId();
                return storage.Store(contents, id);
            };
        }
Example #10
0
 public RepoTimelineProvider(IIdGenerator generator, ITransactionManager trans, IRepository<TimelineItem> repoTi, IRepository<TimelineItemHistory> repoTih)
 {
     this.generator = generator;
     this.trans = trans;
     this.repoTi = repoTi;
     this.repoTih = repoTih;
 }
        public bool GetDocumentId(out object id, out Type idNominalType, out IIdGenerator idGenerator)
        {
            id = this.Name;
            idNominalType = typeof(string);
            idGenerator = null;

            return true;
        }
 public IDelivery Create(IModel model,
                         IIdGenerator idGenerator,
                         IMessageTypeResolver messageTypeResolver,
                         IMessageSerializer serializer,
                         ISequenceGenerator sequenceGenerator)
 {
     return inner;
 }
 public MyListWishController(DTOMapper dtoMapper, IUserIdProvider userIdProvider, 
     IRepository<WishList> repository, IIdGenerator<Wish> idGenerator )
 {
     _dtoMapper = dtoMapper;
     _userIdProvider = userIdProvider;
     _repository = repository;
     _idGenerator = idGenerator;
 }
Example #14
0
 /// <summary>
 /// Gets the document Id.
 /// </summary>
 /// <param name="document">The document.</param>
 /// <param name="id">The Id.</param>
 /// <param name="idNominalType">The nominal type of the Id.</param>
 /// <param name="idGenerator">The IdGenerator for the Id type.</param>
 /// <returns>True if the document has an Id.</returns>
 public virtual bool GetDocumentId(
     object document,
     out object id,
     out Type idNominalType,
     out IIdGenerator idGenerator)
 {
     throw new NotSupportedException("Subclass must implement GetDocumentId.");
 }
        public AdminModule(IAggregateRootRepository repository,
                           IIdGenerator idGenerator)
            : base("/write/admin")
        {
            this.RequiresAuthentication();
            this.RequiresClaims(new[] { "Admin" });

            Post["/account/create"] = parameters =>
            {
                var model = this.Bind<EditableAccount>();
                var account = new Domain.Account(idGenerator.NextGuid(),
                    model.Name, model.FirstName, model.LastName, model.Email);

                var password = account.GeneratePassword();

                repository.Save(account);

                return Json(new
                {
                    Account = new Account(account),
                    Password = password
                });
            };

            Post["/account/update/{id:guid}"] = parameters =>
            {
                var model = this.Bind<EditableAccount>();
                var account = repository.GetById<Domain.Account>((Guid)parameters.id);

                if (account != null)
                {
                    account.ChangeDetails(model.Name, model.FirstName, model.LastName, model.Email);

                    repository.Save(account);

                    return Json(new
                    {
                        Account = new Account(account)
                    });
                }

                return null;
            };

            Post["/account/{id:guid}/newpassword"] = parameters =>
            {
                var model = this.Bind<AccountNewPassword>();
                var account = repository.GetById<Domain.Account>((Guid)parameters.id);

                if (account != null)
                {
                    account.ChangePassword(model.Password);
                    repository.Save(account);
                }

                return null;
            };
        }
Example #16
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="idGenerator">A generator to create ids to sorting lines</param>
 /// <param name="configuration">A configuration object</param>
 /// <param name="lines">The character representation of all sorting lines</param>
 public Yard(IIdGenerator idGenerator, IConfiguration configuration, IEnumerable<IEnumerable<char>> lines)
 {
     IdGenerator = idGenerator;
     Configuration = configuration;
     SortingLines = CreateSortingLines(lines);
     YardLocomotive = new YardLocomotive(Configuration);
     Yardmaster = new Yardmaster(YardLocomotive);
     TrainLine = new TrainLine();
 }
 /// <summary>
 /// Gets the document Id.
 /// </summary>
 /// <param name="document">The document.</param>
 /// <param name="id">The Id.</param>
 /// <param name="idNominalType">The nominal type of the Id.</param>
 /// <param name="idGenerator">The IdGenerator for the Id type.</param>
 /// <returns>True if the document has an Id.</returns>
 public bool GetDocumentId(
     object document,
     out object id,
     out Type idNominalType,
     out IIdGenerator idGenerator)
 {
     var bsonDocument = (BsonDocument)document;
     return ((IBsonSerializable)bsonDocument).GetDocumentId(out id, out idNominalType, out idGenerator);
 }
Example #18
0
        public Cache(IIdGenerator idGenerator, IObjectGraph objectGraph, IEnumerable<IMaterializationHook> materializationHooks)
        {
            if (idGenerator == null) throw new ArgumentNullException("idGenerator");
            if (objectGraph == null) throw new ArgumentNullException("objectGraph");
            if (materializationHooks == null) throw new ArgumentNullException("materializationHooks");

            _idGenerator = idGenerator;
            _objectGraph = objectGraph;
            _materializationHooks = materializationHooks;
        }
Example #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IdMap"/> class.
        /// </summary>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="memberGetter">The member getter.</param>
        /// <param name="memberSetter">The member setter.</param>
        /// <param name="valueType">Type of the value.</param>
        /// <param name="idGenerator">The id generator.</param>
        public IdMap(string memberName, Func<object, object> memberGetter, Action<object, object> memberSetter, IIdGenerator idGenerator, IValueConverter valueConverter, object unsavedValue)
            : base("_id", memberName, memberGetter, memberSetter, true)
        {
            if (idGenerator == null)
                throw new ArgumentNullException("idGenerator");

            this.IdGenerator = idGenerator;
            this.UnsavedValue = unsavedValue;
            this.ValueConverter = valueConverter;
        }
Example #20
0
 public GameService(IGameFactory gameFactory, IGameRepository gameRepository,
                    IGameStateRepository gameStateRepository, IIdGenerator idGenerator,
                    IUnitOfWork unitOfWork, IUserRepository userRepository)
 {
     _gameFactory         = gameFactory;
     _gameRepository      = gameRepository;
     _gameStateRepository = gameStateRepository;
     _idGenerator         = idGenerator;
     _unitOfWork          = unitOfWork;
     _userRepository      = userRepository;
 }
 public IndividualTransporterFactory(IObjectBaseFactory objectBaseFactory,
                                     IParameterFactory parameterFactory,
                                     IObjectPathFactory objectPathFactory,
                                     IEntityPathResolver entityPathResolver,
                                     IIndividualPathWithRootExpander individualPathWithRootExpander,
                                     IIdGenerator idGenerator,
                                     IParameterRateRepository parameterRateRepository) :
     base(objectBaseFactory, parameterFactory, objectPathFactory, entityPathResolver, idGenerator, parameterRateRepository, CoreConstants.ORM.TRANSPORTER)
 {
     _individualPathWithRootExpander = individualPathWithRootExpander;
 }
 public ProxyServerConnection(int channelId, IChannel <ProxyPackage> channel, int port, ILogger logger, IIdGenerator idGenerator)
 {
     this.channelId = channelId;
     this.channel   = channel;
     this.channel.PackageReceived += OnPackageReceived;
     socket              = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     backendPort         = port;
     this.logger         = logger;
     this.idGenerator    = idGenerator;
     clientChannelHolder = new ConcurrentDictionary <long, IChannel>();
 }
Example #23
0
 public ElasticsearchSessionFactory(
     IElasticLowLevelClient elasticClient,
     IUniqueNameResolver uniqueNameResolver,
     IIdGenerator idGenerator,
     IEsfStateInputValidator validator)
 {
     _elasticClient      = elasticClient;
     _uniqueNameResolver = uniqueNameResolver;
     _idGenerator        = idGenerator;
     _validator          = validator;
 }
 /// <summary>
 /// Registers an IdGenerator for an Id Type.
 /// </summary>
 /// <param name="type">The Id Type.</param>
 /// <param name="idGenerator">The IdGenerator for the Id Type.</param>
 public static void RegisterIdGenerator(Type type, IIdGenerator idGenerator)
 {
     __configLock.EnterWriteLock();
     try
     {
         __idGenerators[type] = idGenerator;
     }
     finally
     {
         __configLock.ExitWriteLock();
     }
 }
Example #25
0
        public void CreateContext()
        {
            _typeMapper = new Moq.Mock<ITypeMapper>().Object;
            _random = new Moq.Mock<IRandom>().Object;
            _idGenerator = new Moq.Mock<IIdGenerator>().Object;

            var context = Create();

            Assert.That(context.TypeMapper, Is.Not.Null);
            Assert.That(context.Random, Is.Not.Null);
            Assert.That(context.IdGenerator, Is.Not.Null);
        }
Example #26
0
 /// <summary>
 /// Registers an IdGenerator for an Id Type.
 /// </summary>
 /// <param name="type">The Id Type.</param>
 /// <param name="idGenerator">The IdGenerator for the Id Type.</param>
 public static void RegisterIdGenerator(Type type, IIdGenerator idGenerator)
 {
     __configLock.AcquireWriterLock(-1);
     try
     {
         __idGenerators[type] = idGenerator;
     }
     finally
     {
         __configLock.ReleaseWriterLock();
     }
 }
 public AddGameCommandHandler(IGamesContext context,
                              ILogger <AddGameCommandHandler> logger,
                              IGamesService gamesService,
                              IDateTimeService dateTimeService,
                              IIdGenerator idGenerator)
 {
     _context         = context;
     _logger          = logger;
     _gamesService    = gamesService;
     _dateTimeService = dateTimeService;
     _idGenerator     = idGenerator;
 }
        public ProductCommandHandler(ILogger <ProductCommandHandler> logger, IInMemeoryRepository repository, IIdGenerator idGenerator, IEventDispatcher eventDispatcher, IInMemeoryRepository inMemeoryRepository)
        {
            this.logger = logger;

            this.repository = repository;

            this.idGenerator = idGenerator;

            this.eventDispatcher = eventDispatcher;

            _inMemeoryRepository = inMemeoryRepository;
        }
 public SendStoryHandlerTests()
 {
     _userRepository      = Substitute.For <IUserRepository>();
     _storyRepository     = Substitute.For <IStoryRepository>();
     _storyTextPolicy     = Substitute.For <IStoryTextPolicy>();
     _dateTimeProvider    = Substitute.For <IDateTimeProvider>();
     _idGenerator         = Substitute.For <IIdGenerator>();
     _storyRequestStorage = Substitute.For <IStoryRequestStorage>();
     _messageBroker       = Substitute.For <IMessageBroker>();
     _handler             = new SendStoryHandler(_userRepository, _storyRepository, _storyTextPolicy, _dateTimeProvider,
                                                 _idGenerator, _storyRequestStorage, _messageBroker);
 }
Example #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdentityService"/> class.
 /// </summary>
 /// <param name="loggerFactory">The logger factory.</param>
 /// <param name="configuration">The API configuration.</param>
 /// <param name="idGenerator">The generator for unique identifiers.</param>
 /// <param name="principalProvider">The principal provider.</param>
 /// <param name="userManager">The user manager.</param>
 public IdentityService(
     ILoggerFactory loggerFactory,
     IApiConfiguration configuration,
     IIdGenerator idGenerator,
     ICustomPrincipalProvider principalProvider,
     UserManager <UserEntity> userManager)
 {
     logger                 = loggerFactory?.CreateLogger <IdentityService>() ?? throw new ArgumentNullException(nameof(loggerFactory));
     this.configuration     = configuration ?? throw new ArgumentNullException(nameof(configuration));
     this.principalProvider = principalProvider ?? throw new ArgumentNullException(nameof(principalProvider));
     this.userManager       = userManager ?? throw new ArgumentNullException(nameof(userManager));
 }
 public SendStoryHandler(IUserRepository userRepository, IStoryRepository storyRepository,
                         IStoryTextPolicy storyTextPolicy, IDateTimeProvider dateTimeProvider, IIdGenerator idGenerator,
                         IStoryRequestStorage storyRequestStorage, IMessageBroker messageBroker)
 {
     _userRepository      = userRepository;
     _storyRepository     = storyRepository;
     _storyTextPolicy     = storyTextPolicy;
     _dateTimeProvider    = dateTimeProvider;
     _idGenerator         = idGenerator;
     _storyRequestStorage = storyRequestStorage;
     _messageBroker       = messageBroker;
 }
 internal MessageHandler(
     [NotNull] ITeamCityWriter rootWriter,
     [NotNull] ITestCaseFilter testCaseFilter,
     [NotNull] ISuiteNameProvider suiteNameProvider,
     [NotNull] IIdGenerator idGenerator,
     [NotNull] IOptions options)
 {
     _rootWriter        = rootWriter ?? throw new ArgumentNullException(nameof(rootWriter));
     _testCaseFilter    = testCaseFilter ?? throw new ArgumentNullException(nameof(testCaseFilter));
     _suiteNameProvider = suiteNameProvider ?? throw new ArgumentNullException(nameof(suiteNameProvider));
     _idGenerator       = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
     _options           = options;
 }
Example #33
0
 public AddPlayerCommandHandler(
     IPlayersContext context,
     ILogger <AddPlayerCommandHandler> logger,
     IPlayersService playersService,
     IDateTimeService dateTimeService,
     IIdGenerator idGenerator)
 {
     _context         = context;
     _logger          = logger;
     _playersService  = playersService;
     _dateTimeService = dateTimeService;
     _idGenerator     = idGenerator;
 }
Example #34
0
 public ContentProvider(IIdGenerator idGenerator, ITransactionManager trans,
                        IRepository <Category> repoCategory,
                        IRepository <Content> repoContent,
                        IRepository <CategoryContent> repoContentCategory,
                        IRepository <ContentRelation> repoContentRelation)
 {
     this.idGenerator         = idGenerator;
     this.trans               = trans;
     this.repoCategory        = repoCategory;
     this.repoContent         = repoContent;
     this.repoContentCategory = repoContentCategory;
     this.repoContentRelation = repoContentRelation;
 }
 public UserRegistrationService(
     IAuthUserRepository authUserRepository, IClock clock, IIdGenerator idGenerator,
     IRoleRepository roleRepository, IUnitOfWork unitOfWork, IUserRepository userRepository,
     IUserRegistrationDomainService userRegistrationDomainService)
 {
     _authUserRepository = authUserRepository;
     _clock          = clock;
     _idGenerator    = idGenerator;
     _roleRepository = roleRepository;
     _unitOfWork     = unitOfWork;
     _userRepository = userRepository;
     _userRegistrationDomainService = userRegistrationDomainService;
 }
Example #36
0
        private static List CreateList(string listCode, IIdGenerator idGenerator, IListInfoProvider listInfoProvider)
        {
            var listInfo = listInfoProvider.GetListInfoFor(listCode);

            return(new List
            {
                Id = idGenerator.Generate(),
                Name = listInfo.Name,
                Order = listInfo.Order,
                Description = listInfo.Description,
                Enabled = listInfo.Enabled
            });
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateCommandHandler"/> class.
 /// </summary>
 /// <param name="module">The command handler module.</param>
 /// <param name="idGenerator">The generator for unique identifiers.</param>
 /// <param name="serializer">The JSON serializer.</param>
 /// <param name="mediator">The mediator.</param>
 /// <param name="backgroundService">The background service.</param>
 public CreateCommandHandler(
     ICommandHandlerModule module,
     IIdGenerator idGenerator,
     IDefaultJsonSerializer serializer,
     IMediator mediator,
     IBackgroundService backgroundService)
     : base(module)
 {
     this.idGenerator       = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
     this.serializer        = serializer ?? throw new ArgumentNullException(nameof(serializer));
     this.mediator          = mediator ?? throw new ArgumentNullException(nameof(mediator));
     this.backgroundService = backgroundService ?? throw new ArgumentNullException(nameof(backgroundService));
 }
 public DonationsController(
     ApplicationDbContext context,
     TimeZoneInfo serverTimeZone,
     IIdGenerator <long> idGenerator,
     TelemetryClient telemetry,
     IAuthorizationService authorizationService)
 {
     _context              = context;
     _serverTimeZone       = serverTimeZone;
     _idGenerator          = idGenerator;
     _telemetry            = telemetry;
     _authorizationService = authorizationService;
 }
 public TenantStore(
     User creator,
     IDynamoDBContext context,
     IIdGenerator idGenerator,
     IUserRightStore userRightStore,
     ILogger <TenantStore> log)
 {
     Log             = log;
     _creator        = creator;
     _context        = context;
     _idGenerator    = idGenerator;
     _userRightStore = userRightStore;
 }
Example #40
0
 public AddPlayCommandHandler(
     IIdGenerator idGenerator,
     IPlaysContext context,
     ILogger <AddPlayCommandHandler> logger,
     IMapper mapper,
     IPublishEndpoint endpoint)
 {
     _idGenerator = idGenerator;
     _context     = context;
     _logger      = logger;
     _mapper      = mapper;
     _endpoint    = endpoint;
 }
 public WorkflowServersController(
     IWorkflowServerStore store,
     IAuthorizationService authorizationService,
     IIdGenerator idGenerator,
     INotifier notifier,
     IHtmlLocalizer <WorkflowDefinitionsController> localizer)
 {
     _store = store;
     _authorizationService = authorizationService;
     _idGenerator          = idGenerator;
     _notifier             = notifier;
     T = localizer;
 }
        public ReservationsController(
            ICommandBus commandBus,
            IQueryBus queryBus,
            IIdGenerator idGenerator)
        {
            Guard.Against.Null(commandBus, nameof(commandBus));
            Guard.Against.Null(queryBus, nameof(queryBus));
            Guard.Against.Null(idGenerator, nameof(idGenerator));

            this.commandBus  = commandBus;
            this.queryBus    = queryBus;
            this.idGenerator = idGenerator;
        }
        public TemperatureMeasurementsController(
            ICommandBus commandBus,
            IQueryBus queryBus,
            IIdGenerator idGenerator)
        {
            Guard.Against.Null(commandBus, nameof(commandBus));
            Guard.Against.Null(queryBus, nameof(queryBus));
            Guard.Against.Null(idGenerator, nameof(idGenerator));

            this.commandBus  = commandBus;
            this.queryBus    = queryBus;
            this.idGenerator = idGenerator;
        }
Example #44
0
        public CameraManager(ICameraFactory cameraFactory,
                             IIdGenerator idGenerator,
                             ISimpleCollectionFactory collectionFactory)

        {
            _idGenerator   = idGenerator;
            _cameraFactory = cameraFactory;

            _camera2DCollection = collectionFactory.Create <ICameraModel2D>(32);
            _camera3DCollection = collectionFactory.Create <ICameraModel3D>(16);

            _camerasToDestroy = new List <ulong>();
        }
Example #45
0
 public ContentProvider(IIdGenerator idGenerator, ITransactionManager trans,
     IRepository<Category> repoCategory,
     IRepository<Content> repoContent,
     IRepository<CategoryContent> repoContentCategory,
     IRepository<ContentRelation> repoContentRelation)
 {
     this.idGenerator = idGenerator;
     this.trans = trans;
     this.repoCategory = repoCategory;
     this.repoContent = repoContent;
     this.repoContentCategory = repoContentCategory;
     this.repoContentRelation = repoContentRelation;
 }
Example #46
0
 public WorkflowBuilder(IIdGenerator idGenerator, IServiceProvider serviceProvider, IGetsStartActivitiesForCompositeActivityBlueprint startingActivitiesProvider) : base(serviceProvider, startingActivitiesProvider)
 {
     Version                = 1;
     IsLatest               = true;
     IsPublished            = true;
     Variables              = new Variables();
     CustomAttributes       = new Variables();
     ActivityId             = idGenerator.Generate();
     ActivityType           = typeof(Workflow);
     ActivityTypeName       = nameof(Workflow);
     WorkflowBuilder        = this;
     PropertyValueProviders = new Dictionary <string, IActivityPropertyValueProvider>();
     PersistenceBehavior    = WorkflowPersistenceBehavior.WorkflowBurst;
 }
Example #47
0
        /// <summary>
        /// 生成新的Id
        /// 调用本方法前,请确保调用了 SetIdGenerator 方法做初始化。
        /// 否则将会初始化一个WorkerId为1的对象。
        /// </summary>
        /// <returns></returns>
        public static long NextId()
        {
            if (_IdGenInstance == null)
            {
                _IdGenInstance = new DefaultIdGenerator(
                    new IdGeneratorOptions()
                {
                    WorkerId = 1
                }
                    );
            }

            return(_IdGenInstance.NewLong());
        }
        protected override void Context()
        {
            _idGenerator             = A.Fake <IIdGenerator>();
            _parameter               = new PKSimParameter();
            _ioC                     = A.Fake <OSPSuite.Utility.Container.IContainer>();
            _dimensionRepository     = A.Fake <IDimensionRepository>();
            _creationMetaDataFactory = A.Fake <ICreationMetaDataFactory>();
            var dimensionFactory = A.Fake <IDimensionFactory>();

            A.CallTo(() => dimensionFactory.NoDimension).Returns(Constants.Dimension.NO_DIMENSION);
            A.CallTo(() => _dimensionRepository.DimensionFactory).Returns(dimensionFactory);
            A.CallTo(() => _ioC.Resolve <IParameter>()).Returns(_parameter);
            sut = new PKSimObjectBaseFactory(_ioC, _dimensionRepository, _idGenerator, _creationMetaDataFactory);
        }
Example #49
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Object"></see> class.</summary>
 public UserService(IIdGenerator idGenerate,
                    IEncryptHelper encryptHelper,
                    IRepository <UserEntity> userRepository,
                    IMapper mapper,
                    IUserResourceDomainService userResourceDomainService,
                    IUserRoleDomainService userRoleDomainService)
 {
     this._userRoleDomainService = userRoleDomainService;
     this._idGenerate            = idGenerate;
     this._encryptHelper         = encryptHelper;
     this._userRepository        = userRepository;
     this._mapper = mapper;
     this._userResourceDomainService = userResourceDomainService;
 }
 public FileSystemWorkflowStore(
     IOptions <FileSystemStoreOptions> options,
     IFileSystem fileSystem,
     IIdGenerator idGenerator,
     IWorkflowSerializer workflowSerializer,
     IClock clock)
 {
     this.fileSystem         = fileSystem;
     this.idGenerator        = idGenerator;
     this.workflowSerializer = workflowSerializer;
     this.clock    = clock;
     rootDirectory = options.Value.RootDirectory;
     format        = options.Value.Format;
 }
Example #51
0
 public DefaultScheduleManager(IScheduleTimer timer, IEnumerable<IOperation> operations, IEnumerable<IScheduleTrigger> triggers,
     ITransactionManager trans, IIdGenerator idGenerator,
     IRepository<ScheduleTask> repoTask, IRepository<ScheduleTaskTrigger> repoTaskTrigger, IRepository<SheduleTaskExecuteLog> repoTaskLog)
     : base()
 {
     this.timer = timer;
     this.operations = operations;
     this.triggers = triggers;
     this.trans = trans;
     this.idGenerator = idGenerator;
     this.repoTask = repoTask;
     this.repoTaskTrigger = repoTaskTrigger;
     this.repoTaskLog = repoTaskLog;
 }
Example #52
0
 public FormulaFactory(IObjectBaseFactory objectBaseFactory, IRateObjectPathsRepository rateObjectPathsRepository,
                       IRateFormulaRepository rateFormulaRepository, IDistributionFormulaFactory distributionFactory, IObjectPathFactory objectPathFactory,
                       IDimensionRepository dimensionRepository, IIdGenerator idGenerator,
                       IDynamicFormulaCriteriaRepository dynamicFormulaCriteriaRepository)
 {
     _objectBaseFactory         = objectBaseFactory;
     _rateObjectPathsRepository = rateObjectPathsRepository;
     _rateFormulaRepository     = rateFormulaRepository;
     _distributionFactory       = distributionFactory;
     _objectPathFactory         = objectPathFactory;
     _dimensionRepository       = dimensionRepository;
     _idGenerator = idGenerator;
     _dynamicFormulaCriteriaRepository = dynamicFormulaCriteriaRepository;
 }
Example #53
0
        public DefaultAuthProvider(IPasswordEncryptionProvider pwdEncrypt, IAuthEncryptionProvider authEncrypt, IRandomTextGenerator generator, IHostService host, IIdGenerator idGen, IJsonConvert jsonConvert
            , IRepository<ServerSession> repoSession, IRepository<User> repoUser, IRepository<Role> repoRole, IRepository<UserRole> repoUr, IRepository<RolePrivilege> repoRp)
        {
            this.pwdEncrypt = pwdEncrypt;
            this.authEncrypt = authEncrypt;
            this.generator = generator;
            this.host = host;
            this.idGen = idGen;
            this.jsonConvert = jsonConvert;

            this.repoSession = repoSession;
            this.repoUser = repoUser;
            this.repoRole = repoRole;
            this.repoUr = repoUr;
            this.repoRp = repoRp;
        }
Example #54
0
 public RepoSocialProvider(ITransactionManager trans, IIdGenerator generator,
     IRepository<Org> repoOrg, IRepository<Person> repoPerson, IRepository<School> repoSchool,
     IRepository<Contact> repoContact, IRepository<PersonCertificate> repoPersonCert, IRepository<PersonContact> repoPersonContact,
     IRepository<PersonLink> repoPersonLink, IRepository<StudyResume> repoStudyResume, IRepository<WorkResume> repoWorkResume)
 {
     this.trans = trans;
     this.generator = generator;
     this.repoOrg = repoOrg;
     this.repoPerson = repoPerson;
     this.repoSchool = repoSchool;
     this.repoContact = repoContact;
     this.repoPersonCert = repoPersonCert;
     this.repoPersonContact = repoPersonContact;
     this.repoPersonLink = repoPersonLink;
     this.repoStudyResume = repoStudyResume;
     this.repoWorkResume = repoWorkResume;
 }
Example #55
0
 public RepoBookProvider(IObjectProvider<SSOClient> clientProvider, ISocialProvider socialProvider, ITransactionManager trans, IIdGenerator generator,
     IRepository<Book> repoBook, IRepository<Chapter> repoChapter, IRepository<Publisher> repoPublisher,
     IRepository<BookRemark> repoBookRemark, IRepository<BookContent> repoBookContent,
     IRepository<BookShelf> repoBookShelf, IRepository<BookShelfBook> repoBookShelfBook, IRepository<ReadHistory> repoReadHistory)
 {
     this.clientProvider = clientProvider;
     this.socialProvider = socialProvider;
     this.trans = trans;
     this.generator = generator;
     this.repoBook = repoBook;
     this.repoChapter = repoChapter;
     this.repoPublisher = repoPublisher;
     this.repoBookRemark = repoBookRemark;
     this.repoBookContent = repoBookContent;
     this.repoBookShelf = repoBookShelf;
     this.repoBookShelfBook = repoBookShelfBook;
     this.repoReadHistory = repoReadHistory;
 }
        public ClientModule(IAggregateRootRepository repository,
                            IIdGenerator idGenerator)
            :base("/write/client")
        {
            this.RequiresAuthentication();

            Post["/create"] = parameters =>
            {
                var model = this.Bind<EditableClient>();

                var client = new Domain.Client(idGenerator.NextGuid(), model.Name);

                repository.Save(client);

                return Json(new
                {
                    Client = new Client(client)
                });
            };

            Post["/update/{id:guid}"] = parameters =>
            {
                var model = this.Bind<EditableClient>();

                var client = repository.GetById<Domain.Client>((Guid)parameters.id);

                if (client != null)
                {
                    client.ChangeDetails(model.Name);

                    repository.Save(client);

                    return Json(new
                    {
                        Client = new Client(client)
                    });
                }

                return null;
            };
        }
Example #57
0
 public SSOServerProvider(IObjectProvider<SSOClient[]> clientsProvider, IObjectProvider<SSOServer> serverProvider,
     ISSOConfiguration config, IRandomTextGenerator randomGenerator, IIdGenerator idGenerator, IPasswordEncryptionProvider pwdEncryptor,
     ITransactionManager trans,
     IRepository<User> repoUser, IRepository<Role> repoRole,
     IRepository<UserRole> repoUserRole, IRepository<RolePermission> repoRolePermission, IRepository<Permission> repoPermission,
     IRepository<ServerSession> repoServerSession)
 {
     this.serverProvider = serverProvider;
     this.clientsProvider = clientsProvider;
     this.config = config;
     this.randomGenerator = randomGenerator;
     this.idGenerator = idGenerator;
     this.pwdEncryptor = pwdEncryptor;
     this.trans = trans;
     this.repoUser = repoUser;
     this.repoRole = repoRole;
     this.repoUserRole = repoUserRole;
     this.repoRolePermission = repoRolePermission;
     this.repoPermission = repoPermission;
     this.repoServerSession = repoServerSession;
 }
        public RepositoryStateFlowManager(
            IIdGenerator idGenerator,
            ITransactionManager trans,
            IRepository<BizFlow> repoStateFlow,
            IRepository<FlowState> repoFlowState,
            IRepository<FlowIncome> repoFlowIncome,
            IRepository<FlowOutcome> repoFlowOutcome,
            IRepository<FlowOperation> repoFlowOp,
            IRepository<FlowStateOperation> repoStateOp,
            IRepository<FlowStateIncome> repoStateIncome,
            IRepository<FlowStateOutcome> repoStateOutcome,
            IRepository<TargetFlow> repoTargetFlow,
            IRepository<TargetState> repoTargetState,
            IRepository<TargetIncome> repoTargetIncome,
            IRepository<TargetOutcome> repoTargetOutcome,
            IRepository<NextBizFlow> repoNextFlow,
            IRepository<NextTargetState> repoNextTargetState)
        {
            this.idGenerator = idGenerator;
            this.trans = trans;
            this.repoBizFlow = repoStateFlow;
            this.repoFlowState = repoFlowState;
            this.repoFlowIncome = repoFlowIncome;
            this.repoFlowOutcome = repoFlowOutcome;
            this.repoFlowOp = repoFlowOp;
            this.repoStateOp = repoStateOp;
            this.repoStateIncome = repoStateIncome;
            this.repoStateOutcome = repoStateOutcome;
            this.repoTargetFlow = repoTargetFlow;
            this.repoTargetState = repoTargetState;
            this.repoTargetIncome = repoTargetIncome;
            this.repoTargetOutcome = repoTargetOutcome;
            this.repoNextFlow = repoNextFlow;
            this.repoNextTargetState = repoNextTargetState;

            Logger = NullLogger.Instance;
        }
 public bool GetDocumentId(out object id, out Type idNominalType, out IIdGenerator idGenerator)
 {
     var message = string.Format("GetDocumentId method cannot be called on a {0}.", this.GetType().Name);
     throw new NotSupportedException(message);
 }
		public override bool GetDocumentId(object document, out object id, out Type idNominalType, out IIdGenerator idGenerator)
		{
			throw new NotSupportedException();
		}