private static IDatabase CreateManagedDatabase(FbConnectionString options) { var connection = new GdsConnection(options.UserID, options.Password, options.DataSource, options.Port, options.PacketSize, Charset.GetCharset(options.Charset)); connection.Connect(); connection.Identify(options.Database); switch (connection.ProtocolVersion) { case IscCodes.PROTOCOL_VERSION13: return(new Client.Managed.Version13.GdsDatabase(connection)); case IscCodes.PROTOCOL_VERSION12: return(new Client.Managed.Version12.GdsDatabase(connection)); case IscCodes.PROTOCOL_VERSION11: return(new Client.Managed.Version11.GdsDatabase(connection)); case IscCodes.PROTOCOL_VERSION10: return(new Client.Managed.Version10.GdsDatabase(connection)); default: throw UnsupportedProtocolException(); } }
private static IServiceManager CreateManagedServiceManager(FbConnectionString options) { var connection = new GdsConnection(options.UserID, options.Password, options.DataSource, options.Port, options.PacketSize, Charset.GetCharset(options.Charset)); connection.Connect(); connection.Identify(!string.IsNullOrEmpty(options.Database) ? options.Database : string.Empty); switch (connection.ProtocolVersion) { case IscCodes.PROTOCOL_VERSION13: case IscCodes.PROTOCOL_VERSION12: case IscCodes.PROTOCOL_VERSION11: case IscCodes.PROTOCOL_VERSION10: return(new Client.Managed.Version10.GdsServiceManager(connection)); default: throw new NotSupportedException("Protocol not supported."); } }
private static IServiceManager CreateManagedServiceManager(ConnectionString options) { var connection = new GdsConnection(options.UserID, options.Password, options.DataSource, options.Port, options.PacketSize, Charset.GetCharset(options.Charset), options.Compression, FbWireCryptToWireCryptOption(options.WireCrypt)); connection.Connect(); connection.Identify(!string.IsNullOrEmpty(options.Database) ? options.Database : string.Empty); switch (connection.ProtocolVersion) { case IscCodes.PROTOCOL_VERSION13: return(new Client.Managed.Version13.GdsServiceManager(connection)); case IscCodes.PROTOCOL_VERSION12: return(new Client.Managed.Version12.GdsServiceManager(connection)); case IscCodes.PROTOCOL_VERSION11: return(new Client.Managed.Version11.GdsServiceManager(connection)); case IscCodes.PROTOCOL_VERSION10: return(new Client.Managed.Version10.GdsServiceManager(connection)); default: throw UnsupportedProtocolException(); } }