C# 클래스 SqlAzureWriterStormApplication.SqlAzureBolt

OVERVIEW: SqlAzureWriterBolt - A bolt that can insert, upsert or delete from Sql Azure. Change or override the execute method to as per your requirements. The bolt uses parameterized T-SQL statements based on specified table schema PRE-REQUISITES: 1. Sql Azure Server, Database and Table - All values need to be specifed in AppSettings a. SqlAzureConnectionString - your Sql Azure server connection string b. SqlAzureTableName - your Sql Azure table name c. SqlAzureTableColumns - comma separated column names, required for query building 2. Sql Table Schema a. Note that Sql Azure requires your table schema to have a clustered index b. This can be easily acheived by including an identity column as the primary key which gets automatically generated on each insert c. For e.g.: Create Table #your_table# ([ID] INT IDENTITY PRIMARY KEY, ... ASSUMPTIONS: 1. The type infering of tuple field (SqlParameter) is left to the provider as we use AddWithValue. To avoid surprises you can specify SqlDbType directly. NUGET: 1. SCP.Net - http://www.nuget.org/packages/Microsoft.SCP.Net.SDK/ 2. Sql Transient Fault handling - http://www.nuget.org/packages/EnterpriseLibrary.TransientFaultHandling.Data REFERENCES: 1. Reliably connect to Azure SQL Database - https://msdn.microsoft.com/en-us/library/azure/dn864744.aspx
상속: ISCPBolt
파일 보기 프로젝트 열기: Azure-Samples/hdinsight-dotnet-storm-powerbi

공개 프로퍼티들

프로퍼티 타입 설명
context Context
enableAck bool

Private Properties

프로퍼티 타입 설명

공개 메소드들

메소드 설명
Delete ( List keys, List row ) : void
Execute ( SCPTuple tuple ) : void
ExecuteCommand ( SqlCommand sqlCommand ) : void
GenerateInsertTSql ( ) : string

Generates T-SQL Insert statement

GenerateUpdateTSql ( List keys ) : string
GenerateUpsertTSql ( List keys ) : string
GenerateWhereTSql ( List keys ) : string

Instead of using TableColumns we will use the keys list

Get ( Context context, Object>.Dictionary parms ) : SqlAzureBolt

A delegate method to return the instance of this class

HandleException ( Exception ex ) : void

Log the exception and reset any prepared commands and connections

InitializeSqlAzure ( ) : void

Initialize the Sql Azure settings and connections

InitializeSqlAzureConnection ( ) : void

Initialize Sql Azure Connection if not open

Insert ( List row ) : void
PrepareSqlDeleteCommand ( List keys, List row ) : void

Prepares SQL Delete command

PrepareSqlInsertCommand ( List row ) : void

Prepares Sql Insert Command

PrepareSqlUpsertCommand ( List keys, List row ) : void
SqlAzureBolt ( Context context, Object>.Dictionary parms ) : Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling
Upsert ( List keys, List row ) : void

메소드 상세

Delete() 공개 메소드

public Delete ( List keys, List row ) : void
keys List
row List
리턴 void

Execute() 공개 메소드

public Execute ( SCPTuple tuple ) : void
tuple SCPTuple
리턴 void

ExecuteCommand() 공개 메소드

public ExecuteCommand ( SqlCommand sqlCommand ) : void
sqlCommand System.Data.SqlClient.SqlCommand
리턴 void

GenerateInsertTSql() 공개 메소드

Generates T-SQL Insert statement
public GenerateInsertTSql ( ) : string
리턴 string

GenerateUpdateTSql() 공개 메소드

public GenerateUpdateTSql ( List keys ) : string
keys List
리턴 string

GenerateUpsertTSql() 공개 메소드

public GenerateUpsertTSql ( List keys ) : string
keys List
리턴 string

GenerateWhereTSql() 공개 메소드

Instead of using TableColumns we will use the keys list
public GenerateWhereTSql ( List keys ) : string
keys List
리턴 string

Get() 공개 정적인 메소드

A delegate method to return the instance of this class
public static Get ( Context context, Object>.Dictionary parms ) : SqlAzureBolt
context Context SCP Context, automatically passed by SCP.Net
parms Object>.Dictionary
리턴 SqlAzureBolt

HandleException() 공개 메소드

Log the exception and reset any prepared commands and connections
public HandleException ( Exception ex ) : void
ex System.Exception The exception thrown
리턴 void

InitializeSqlAzure() 공개 메소드

Initialize the Sql Azure settings and connections
public InitializeSqlAzure ( ) : void
리턴 void

InitializeSqlAzureConnection() 공개 메소드

Initialize Sql Azure Connection if not open
public InitializeSqlAzureConnection ( ) : void
리턴 void

Insert() 공개 메소드

public Insert ( List row ) : void
row List
리턴 void

PrepareSqlDeleteCommand() 공개 메소드

Prepares SQL Delete command
public PrepareSqlDeleteCommand ( List keys, List row ) : void
keys List Index of keys within the tuple fields which need to be deleted
row List
리턴 void

PrepareSqlInsertCommand() 공개 메소드

Prepares Sql Insert Command
public PrepareSqlInsertCommand ( List row ) : void
row List
리턴 void

PrepareSqlUpsertCommand() 공개 메소드

public PrepareSqlUpsertCommand ( List keys, List row ) : void
keys List
row List
리턴 void

SqlAzureBolt() 공개 메소드

public SqlAzureBolt ( Context context, Object>.Dictionary parms ) : Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling
context Context
parms Object>.Dictionary
리턴 Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling

Upsert() 공개 메소드

public Upsert ( List keys, List row ) : void
keys List
row List
리턴 void

프로퍼티 상세

context 공개적으로 프로퍼티

public Context context
리턴 Context

enableAck 공개적으로 프로퍼티

public bool enableAck
리턴 bool