/// <summary> /// Fetches the user options from the server and closes connection /// </summary> public void GetUserOptions(ILoginInfo loginInfo, Action <ConnectionSystemState, UserOptions> callback) { AsyncAction.Invoke(GetUserOptionsSync, loginInfo, callback); }
protected ExcelHandlerAbstract(ILoginInfo loginInfo, IExcelExportHandler exportHandler, IConfigProvider configProvider) { LoginInfo = loginInfo; _exportHandler = exportHandler; _configProvider = configProvider; }
//HostName, Username, password, PortNumber, SelectedGroup) public bool Connect(string hostname, string username, string password, ushort portNumber, Symbol groupID, string locale) { IsConnected = false; var logonInfo = new StubLoginInfo { Hostname = hostname, //Hostname = User specified hostname, Port = portNumber, //Port = 1338, Security = TransportSecurity.Insecure, //Security = 0, UserName = username, GroupID = groupID, Locale = locale //GroupID = Symbol.Intern("Pdmusers") }; LoginInfo = logonInfo; var client = new TcpMessageClient( hostname, portNumber, TransportSecurity.Insecure); lock (this.interlock) this.client = client; // insert logging between stub and client BidiSharedPipe shared = new BidiSharedPipe(); if (this.LogMessage != null) { shared.Send.MessageReceived += new LogPipe("sent", this.LogMessage).PostMessage; shared.Recv.MessageReceived += new LogPipe("recv", this.LogMessage).PostMessage; } shared.Send.MessageReceived += client.SendPipe.PostMessage; client.ReceivePipe = shared.Recv; shared.Recv.PipeDropped += OnConnectionDropped; client.StartReceiving(); // create a stub system interface and get back some IDL Message idl; var connectSettings = new ConnectSettings { Client = shared, Secret = password, UiClientVersion = appVersion, ClientType = "SSEClientUi" }; var systemInterface = SystemInterfaceStub.Connect(connectSettings, logonInfo, out idl); lock (this.interlock) { idl.Extract(Symbol.Intern("GroupID"), out this.groupID); this.systemInterface = systemInterface; _idl = idl; IsConnected = true; } sessionId_ = client.SessionId; remIPAddress = connectSettings.remIPAddress; // this session as seen by remote remPort = connectSettings.remPort; // this session as seen by remote return(IsConnected); }
/// <summary> /// /// </summary> /// <param name="dbOptions"></param> /// <param name="options"></param> /// <param name="sqlAdapter">数据库适配器</param> /// <param name="loggerFactory">日志工厂</param> /// <param name="loginInfo">登录信息</param> protected DbContextOptionsAbstract(DbOptions dbOptions, DbConnectionOptions options, ISqlAdapter sqlAdapter, ILoggerFactory loggerFactory, ILoginInfo loginInfo) { if (options.Name.IsNull()) { throw new ArgumentNullException(nameof(options.Name), "数据库连接名称未配置"); } if (options.ConnString.IsNull()) { throw new ArgumentNullException(nameof(options.ConnString), "数据库连接字符串未配置"); } DbOptions = dbOptions; Name = options.Name; ConnectionString = options.ConnString; SqlAdapter = sqlAdapter; LoggerFactory = loggerFactory; LoginInfo = loginInfo; if (options.EntityTypes != null && options.EntityTypes.Any()) { foreach (var entityType in options.EntityTypes) { EntityDescriptorCollection.Add(new EntityDescriptor(entityType, sqlAdapter, new EntitySqlBuilder())); } } }
public SQLiteDbContextOptions(DbOptions dbOptions, DbModuleOptions options, ILoggerFactory loggerFactory, ILoginInfo loginInfo) : base(dbOptions, options, new SQLiteAdapter(dbOptions, options), loggerFactory, loginInfo) { SqlMapper.AddTypeHandler(new GuidTypeHandler()); if (options.ConnectionString.IsNull()) { options.Version = dbOptions.Version; string dbFilePath = Path.Combine(AppContext.BaseDirectory, "Db"); if (DbOptions.Server.NotNull()) { dbFilePath = Path.GetFullPath(DbOptions.Server); } dbFilePath = Path.Combine(dbFilePath, options.Database); var connStrBuilder = new SqliteConnectionStringBuilder { DataSource = $"{dbFilePath}.db", Mode = SqliteOpenMode.ReadWriteCreate }; options.ConnectionString = connStrBuilder.ToString(); } }
/// <summary> /// /// </summary> /// <param name="dbOptions"></param> /// <param name="options"></param> /// <param name="loggerFactory"></param> /// <param name="loginInfo"></param> public MySqlDbContextOptions(DbOptions dbOptions, DbModuleOptions options, ILoggerFactory loggerFactory, ILoginInfo loginInfo) : base(dbOptions, options, new MySqlAdapter(dbOptions, options), loggerFactory, loginInfo) { if (options.ConnectionString.IsNull()) { Check.NotNull(dbOptions.Server, nameof(dbOptions.Server), "数据库服务器地址不能为空"); Check.NotNull(dbOptions.UserId, nameof(dbOptions.UserId), "数据库用户名不能为空"); Check.NotNull(dbOptions.Password, nameof(dbOptions.Password), "数据库密码不能为空"); options.Version = dbOptions.Version; var connStrBuilder = new MySqlConnectionStringBuilder { Server = DbOptions.Server, Port = DbOptions.Port > 0 ? (uint)DbOptions.Port : 3306, Database = options.Database, UserID = DbOptions.UserId, Password = DbOptions.Password, AllowUserVariables = true, CharacterSet = "utf8", SslMode = MySqlSslMode.None, AllowPublicKeyRetrieval = true }; options.ConnectionString = connStrBuilder.ToString(); } }
public PermissionValidateHandler(IOptionsMonitor <AdminOptions> optionsAccessor, IAccountService accountService, ILoginInfo loginInfo, SystemConfigModel systemConfig) { _options = optionsAccessor.CurrentValue; _accountService = accountService; _loginInfo = loginInfo; _systemConfig = systemConfig; }
public SqlServerDbContextOptions(DbOptions dbOptions, DbConnectionOptions options, ILoggerFactory loggerFactory, ILoginInfo loginInfo) : base(dbOptions, options, new SqlServerAdapter(options), loggerFactory, loginInfo) { }
public JobController(ILoginInfo loginInfo, IJobService JobService) { _service = JobService; }
public RoleUserController(ILoginInfo loginInfo, IRoleUserService RoleUserService) { _service = RoleUserService; }
public AttachmentController(ILoginInfo loginInfo, IAttachmentService AttachmentService, WebConfigModel webConfig) { _service = AttachmentService; _webConfig = webConfig; }
public PermissionValidateHandler(IOptionsMonitor <AdminOptions> optionsAccessor, IAccountService accountService, ILoginInfo loginInfo, ISystemService systemService) { _options = optionsAccessor.CurrentValue; _accountService = accountService; _loginInfo = loginInfo; _systemConfig = systemService.GetConfig().Result.Data; }