本文整理汇总了C#中ConnectionProvider类的典型用法代码示例。如果您正苦于以下问题:C# ConnectionProvider类的具体用法?C# ConnectionProvider怎么用?C# ConnectionProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionProvider类属于命名空间,在下文中一共展示了ConnectionProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:fjiang2,项目名称:sqlcon,代码行数:32,代码来源:Side.cs
示例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;
}
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:13,代码来源:Slot.cs
示例3: RiaDbConnection
public RiaDbConnection(ConnectionProvider provider)
{
this.Provider = provider;
this.ConnectionString = Provider.ConnectionString;
this.DataSource = Provider.DataSource;
this.database = Provider.InitialCatalog;
}
开发者ID:fjiang2,项目名称:sqlcon,代码行数:7,代码来源:RiaDbConnection.cs
示例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();
}
开发者ID:fjiang2,项目名称:sqlcon,代码行数:25,代码来源:SqlEditor.cs
示例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());
}
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:7,代码来源:RemoveTextPacket.cs
示例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());
}
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:7,代码来源:InjectDisplayPacket.cs
示例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);
}
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:11,代码来源:MessageProvider.cs
示例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());
}
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:8,代码来源:RemoveCreatureTextPacket.cs
示例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,
};
}
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:15,代码来源:PacketFactory.cs
示例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);
}
开发者ID:fjiang2,项目名称:sqlcon,代码行数:8,代码来源:SqlScript.cs
示例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);
}
开发者ID:fjiang2,项目名称:sqlcon,代码行数:9,代码来源:XmlDbConnection.cs
示例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());
}
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:11,代码来源:UpdateCreatureTextPacket.cs
示例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;
}
开发者ID:VimalKumarS,项目名称:mono-tls,代码行数:11,代码来源:InstrumentationConnectionFilter.cs
示例14: Edit
public ActionResult Edit(int id, ConnectionProvider connectionProvider)
{
try
{
_dbConnectionProviderRepository.Update(connectionProvider);
return RedirectToAction("Index");
}
catch
{
return View(connectionProvider);
}
}
开发者ID:leloulight,项目名称:LucentDb,代码行数:12,代码来源:ConnectionProviderController.cs
示例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();
}
}
开发者ID:leloulight,项目名称:LucentDb,代码行数:12,代码来源:WebApiConnectionProviderRepository.cs
示例16: Create
public ActionResult Create(ConnectionProvider connectionProvider)
{
try
{
_dbConnectionProviderRepository.Insert(connectionProvider);
return RedirectToAction("Index");
}
catch
{
return View(connectionProvider);
}
}
开发者ID:leloulight,项目名称:LucentDb,代码行数:12,代码来源:ConnectionProviderController.cs
示例17: DbProvider
public DbProvider(string script, ConnectionProvider provider)
{
this.script = script;
this.provider = provider;
this.DbConnection = this.provider.NewDbConnection;
this.DbCommand = NewDbCommand();
if (this.script.Contains(" ")) //Stored Procedure Name does not contain a space letter
this.DbCommand.CommandType = CommandType.Text;
else
this.DbCommand.CommandType = CommandType.StoredProcedure;
}
开发者ID:fjiang2,项目名称:sqlcon,代码行数:13,代码来源:DbProvider.cs
示例18: DeleteRedemption
public void DeleteRedemption(int nTransactionID, int qtyOfItemToRestoreAfterDelete)
{
TblRewardsTransaction rewardTrans = new TblRewardsTransaction();
rewardTrans.NTransactionID = nTransactionID;
rewardTrans.SelectOne();
if (rewardTrans.NTypeID != 2 || (Convert.ToDateTime(rewardTrans.DtDate.Value).Date != DateTime.Now.Date && ACMSLogic.User.RightsLevelID != 9000))
throw new Exception("You have no right to delete this record. It is not a redemption or the redemption date is before today. ");
string itemCode = rewardTrans.StrReferenceNo.IsNull ? "" : rewardTrans.StrReferenceNo.Value;
//TblProductInventory productInvent = new TblProductInventory();
//productInvent.StrProductCode = itemCode;
//productInvent.SelectOne();
//productInvent.NQuantity = ACMS.Convert.ToInt32(productInvent.NQuantity) + qtyOfItemToRestoreAfterDelete;
ACMSDAL.ConnectionProvider connProvider = new ConnectionProvider();
try
{
rewardTrans.MainConnectionProvider = connProvider;
//productInvent.MainConnectionProvider = connProvider;
connProvider.OpenConnection();
connProvider.BeginTransaction("DeleteRedemption");
rewardTrans.Delete();
//productInvent.Update();
connProvider.CommitTransaction();
}
catch (Exception)
{
connProvider.RollbackTransaction("DeleteRedemption");
throw;
}
finally
{
if (connProvider.CurrentTransaction != null)
connProvider.CurrentTransaction.Dispose();
if (connProvider.DBConnection != null)
{
if (connProvider.DBConnection.State == ConnectionState.Open)
connProvider.DBConnection.Close();
}
rewardTrans.MainConnactionIsCreatedLocal = true;
//productInvent.MainConnactionIsCreatedLocal = true;
}
}
开发者ID:kimykunjun,项目名称:test,代码行数:51,代码来源:LoyaltyProgram.cs
示例19: FirstThrowsSocketUsesSecondAndWorksTwice
public void FirstThrowsSocketUsesSecondAndWorksTwice()
{
var d1 = new DummyConnectionFactoryWrapper(new SocketException(123));
var d2 = new DummyConnectionFactoryWrapper(true);
var cp = new ConnectionProvider(d2, d1);
var connection = cp.GetConnection();
Assert.NotNull(connection);
var connection2 = cp.GetConnection();
Assert.NotNull(connection2);
}
开发者ID:csuffyy,项目名称:BeeHive,代码行数:14,代码来源:ConnectionPtoviderTests.cs
示例20: FirstConnectionNoyOpenUsesSecondAndWorksTwice
public void FirstConnectionNoyOpenUsesSecondAndWorksTwice()
{
var d1 = new DummyConnectionFactoryWrapper(false);
var d2 = new DummyConnectionFactoryWrapper(true);
var cp = new ConnectionProvider(d2, d1);
var connection = cp.GetConnection();
Assert.NotNull(connection);
var connection2 = cp.GetConnection();
Assert.NotNull(connection2);
Assert.Equal(1, d1.NumberOfTimesCalled);
}
开发者ID:csuffyy,项目名称:BeeHive,代码行数:14,代码来源:ConnectionPtoviderTests.cs
注:本文中的ConnectionProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论