本文整理汇总了C#中ConnectionProvider类的典型用法代码示例。如果您正苦于以下问题:C# ConnectionProvider类的具体用法?C# ConnectionProvider怎么用?C# ConnectionProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionProvider类属于命名空间,在下文中一共展示了ConnectionProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteSqlScript
private static bool ExecuteSqlScript(ConnectionProvider provider, string scriptFile)
{
if (!File.Exists(scriptFile))
{
stdio.ErrorFormat("no input file found : {0}", scriptFile);
return false;
}
stdio.WriteLine("Execute {0}", scriptFile);
var script = new SqlScript(provider, scriptFile);
script.Reported += (sender, e) =>
{
// stdio.WriteLine("processed: {0}>{1}", e.Value1, e.Value2);
};
bool hasError = false;
script.Error += (sender, e) =>
{
hasError = true;
stdio.ErrorFormat("line:{0}, {1}, SQL:{2}", e.Line, e.Exception.Message, e.Command);
};
Func<bool> stopOnError = () =>
{
return !stdio.YesOrNo("are you sure to contune (yes/no)?:");
};
script.Execute(stopOnError);
stdio.WriteLine("completed to run {0}", scriptFile);
return !hasError;
}
示例2: Slot
/// <summary>
/// Initializes a new instance of the <see cref="Slot"/> class.
/// </summary>
/// <param name="address">The address.</param>
/// <param name="connection">The connection.</param>
/// <param name="id">The id.</param>
public Slot(uint address, ConnectionProvider connection, InventoryID id)
{
this.address = address;
this.id = id;
this.memory = connection.Memory;
this.connection = connection;
}
示例3: RiaDbConnection
public RiaDbConnection(ConnectionProvider provider)
{
this.Provider = provider;
this.ConnectionString = Provider.ConnectionString;
this.DataSource = Provider.DataSource;
this.database = Provider.InitialCatalog;
}
示例4: SqlEditor
public SqlEditor(Configuration cfg, ConnectionProvider provider, FileLink link)
{
InitializeComponent(cfg);
this.cfg = cfg;
this.provider = provider;
textBox.Document.Blocks.Clear();
if (link != null)
{
this.link = link;
string text = link.ReadAllText();
textBox.Document.Blocks.Add(new Paragraph(new Run(text)));
}
else
{
this.link = FileLink.CreateLink(untitled);
}
UpdateTitle();
tabControl.SelectionChanged += TabControl_SelectionChanged;
textBox.SelectionChanged += TextBox_SelectionChanged;
textBox.TextChanged += TextBox_TextChanged;
textBox.Focus();
}
示例5: Create
public static RemoveTextPacket Create(ConnectionProvider connection, string TextName)
{
PipePacketBuilder p = new PipePacketBuilder(connection, PipePacketType.RemoveText);
p.AddString(TextName);
return new RemoveTextPacket(connection, p.GetPacket());
}
示例6: Create
public static InjectDisplayPacket Create(ConnectionProvider connection, bool Injected)
{
PipePacketBuilder p = new PipePacketBuilder(connection, PipePacketType.InjectDisplayText);
p.AddByte(Convert.ToByte(Injected));
return new InjectDisplayPacket(connection, p.GetPacket());
}
示例7: MessageProvider
/// <summary>
/// Initializes a new instance of the <see cref="MessageProvider"/> class.
/// </summary>
/// <param name="connection">The connection.</param>
public MessageProvider(ConnectionProvider connection)
{
Connection = connection;
Server = new Actions.Messages.Server(connection);
System = new Actions.Messages.System(connection);
Screen = new Actions.Messages.Screen(connection);
}
示例8: Create
public static RemoveCreatureTextPacket Create(ConnectionProvider connection, int CreatureID, string CreatureName)
{
PipePacketBuilder p = new PipePacketBuilder(connection, PipePacketType.RemoveCreatureText);
p.AddLong(CreatureID);
p.AddString(CreatureName);
return new RemoveCreatureTextPacket(connection, p.GetPacket());
}
示例9: BindPacket
/// <summary>
/// Binds the packet.
/// </summary>
/// <param name="encryptedData">The encrypted data.</param>
/// <param name="connection">The connection.</param>
/// <param name="cripto">The cripto.</param>
/// <returns></returns>
public static Packet BindPacket(byte[] data, ConnectionProvider connection)
{
return new Packet {
Data = data,
ConnectionSource = connection,
InterceptedDate = DateTime.Now,
};
}
示例10: SqlScript
public SqlScript(ConnectionProvider provider, string scriptFile)
{
this.provider = provider;
this.scriptFile = scriptFile;
if (!File.Exists(scriptFile))
throw new FileNotFoundException("cannot find file", scriptFile);
}
示例11: XmlDbConnection
public XmlDbConnection(ConnectionProvider provider)
{
this.Provider = provider;
this.ConnectionString = Provider.ConnectionString;
this.DataSource = Provider.DataSource;
this.database = Provider.InitialCatalog;
this.FileLink = FileLink.CreateLink(provider.DataSource, provider.UserId, provider.Password);
}
示例12: Create
public static UpdateCreatureTextPacket Create(ConnectionProvider connection, int CreatureID, string CreatureName, Location TextLoc, string NewText)
{
PipePacketBuilder p = new PipePacketBuilder(connection, PipePacketType.UpdateCreatureText);
p.AddLong(CreatureID);
p.AddString(CreatureName);
p.AddShort(TextLoc.X);
p.AddShort(TextLoc.Y);
p.AddString(NewText);
return new UpdateCreatureTextPacket(connection, p.GetPacket());
}
示例13: IsSupported
protected virtual bool IsSupported (ConnectionProvider provider)
{
if (HasFlag (InstrumentationConnectionFlags.RequireMonoClient) && !SupportsMonoExtensions (provider))
return false;
if (HasFlag (InstrumentationConnectionFlags.RequireEcDhe) && !SupportsEcDhe (provider))
return false;
if ((provider.Flags & ConnectionProviderFlags.SupportsTls12) == 0)
return false;
return true;
}
示例14: Edit
public ActionResult Edit(int id, ConnectionProvider connectionProvider)
{
try
{
_dbConnectionProviderRepository.Update(connectionProvider);
return RedirectToAction("Index");
}
catch
{
return View(connectionProvider);
}
}
示例15: Update
public void Update(string name, string value, int id)
{
using (var client = new HttpClient(_messageHandler))
{
client.BaseAddress = new Uri(_baseAddress);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var connectionProvider = new ConnectionProvider(id, name, value);
var response = client.PutAsync(UrlBase, connectionProvider, new JsonMediaTypeFormatter()).Result;
response.EnsureSuccessStatusCode();
}
}