示例#1
0
        /// <summary>
        ///     通过自定义数据链接符,连接数据库
        /// </summary>
        /// <param name="connectionString">数据库连接字符串</param>
        /// <param name="db">数据库类型</param>
        /// <param name="commandTimeout">SQL执行超时时间</param>
        /// <param name="dataVer">数据库版本(针对不同的数据库版本的优化)</param>
        protected DbContext(string connectionString, eumDbType db = eumDbType.SqlServer, int commandTimeout = 30, string dataVer = null)
        {
            _contextConnection = new ContextConnection(connectionString, db, commandTimeout, dataVer);

            // 实例化子类中,所有Set属性
            ContextSetTypeCacheManger.Cache(this.GetType()).Item2(this);
        }
        private ContextConnection LookupContextConnection(IComponentContext componentContext, Type contextType)
        {
            var contextSettings = componentContext.ResolveOptional <ContextSettings>() ?? new ContextSettings();

            ContextConnection connection = contextSettings.Connections?
                                           .FirstOrDefault(c => c.ContextName == contextType.Name);

            if (connection == null)
            {
                throw new InvalidOperationException(
                          $"Context connection could not be found for the following entity context type: {contextType}.");
            }
            return(connection);
        }
示例#3
0
        protected override async UniTask OnContextActivate(IContext context)
        {
            var graphAsset = await subGraph.LoadAssetTaskAsync(LifeTime);

            var parent = GraphData.Root;
            var graph  = Object.Instantiate(graphAsset.gameObject, parent)
                         .DestroyWith(LifeTime)
                         .GetComponent <UniGraph>();

            var connection = new ContextConnection();

            connection.Connect(context).AddTo(LifeTime);

            await LaunchGraph(graph, connection);

            Complete();
        }
        protected override void UpdateCommands(List <ILifeTimeCommand> nodeCommands)
        {
            base.UpdateCommands(nodeCommands);

            _contextConnection = _contextConnection ?? new ContextConnection();
            LifeTime.AddDispose(_contextConnection);

            var outPort       = UniTask.FromResult <IContext>(PortPair.OutputPort);
            var contextSource = UniTask.FromResult <IContext>(_contextConnection);

            var bindContextToOutput = new MessageBroadcastCommand(_contextConnection, PortPair.OutputPort);
            //register all Context Sources Data into target context asset
            var registerDataSourceIntoContext = new RegisterDataSourceCommand(contextSource, _dataSources);
            //Register context to output port
            var contextToOutputPortCommand = new DataSourceTaskCommand <IContext>(contextSource, outPort);

            var contextContainerBindCommand = new ParentContextContainerBindCommand(_contextConnection, _parentContextContainer);

            nodeCommands.Add(bindContextToOutput);
            nodeCommands.Add(registerDataSourceIntoContext);
            nodeCommands.Add(contextToOutputPortCommand);
            nodeCommands.Add(contextContainerBindCommand);
        }
示例#5
0
 public ApplicationUserStore(ContextConnection context)
     : base(context)
 {
 }
示例#6
0
 public GubernatorialResultRepository(ContextConnection contextConnection)
 {
     _contextConnection = contextConnection;
 }
示例#7
0
 public ElectionRepository(ContextConnection contextConnection)
     : base(contextConnection)
 {
 }
 public WomenRepResultRepository(ContextConnection contextConnection)
 {
     _contextConnection = contextConnection;
 }
示例#9
0
 public CountyRepository(ContextConnection contextConnection, IRegionRepository regionRepository) : base(contextConnection)
 {
     _regionRepository = regionRepository;
 }
 public PollingCentreRepository(ContextConnection contextConnection, IWardRepository wardRepository) : base(contextConnection)
 {
     _wardRepository = wardRepository;
 }
 public SettingsRepository(ContextConnection contextConnection)
     : base(contextConnection)
 {
 }
 public UserRepository(ContextConnection contextConnection)
     : base(contextConnection)
 {
 }
 public McaResultRepository(ContextConnection contextConnection)
 {
     _contextConnection = contextConnection;
 }
 public BaseRepository(ContextConnection contextConnection)
 {
     ConnectionString = contextConnection.VtsConnectionString;
 }
示例#15
0
 public ReferendumResultRepository(ContextConnection contextConnection)
 {
     _contextConnection = contextConnection;
 }
示例#16
0
 public CandidateRepository(ContextConnection contextConnection, IPoliticalPartyRepository politicalPartyRepository, IRaceRepository raceRepository)
     : base(contextConnection)
 {
     _politicalPartyRepository = politicalPartyRepository;
     _raceRepository           = raceRepository;
 }
 public PoliticalPartyRepository(ContextConnection contextConnection)
     : base(contextConnection)
 {
 }
 public SingleStateToken()
 {
     _context = new ContextConnection();
 }
示例#19
0
 public RaceRepository(ContextConnection contextConnection, IElectionRepository electionRepository)
     : base(contextConnection)
 {
     _electionRepository = electionRepository;
 }
 public ConstituencyRepository(ContextConnection contextConnection, ICountyRepository countyRepository)
     : base(contextConnection)
 {
     _countyRepository = countyRepository;
 }
示例#21
0
 public ContextConnection Init()
 {
     return(dbContext ?? (dbContext = new Context()));
 }
 public PresidentialResultRepository(ContextConnection contextConnection)
 {
     _contextConnection = contextConnection;
 }