-
Notifications
You must be signed in to change notification settings - Fork 20
API Reference
#API Reference
Here's a quick summary of what the object hierarchy looks like:
- MetaBuilder
- Tables
- Name
- Columns
- DataTypes
- IsIdentity
- IsNullable
- Precision
- Scale
- Length
- IsPrimaryKey
- IsForeignKey
- ParentRelationships
- ChildRelationships
- Views
- Name
- Columns
- DataTypes
- IsIdentity
- IsNullable
- Precision
- Scale
- Length
- IsPrimaryKey
- IsForeignKey
- ParentRelationships
- ChildRelationships
- Procedures
- Name
- Parameters
- Name
- DataTypes (ignore if parameter is a table-valued parameter)
- IsTableValue
- TableValue (
Table
object if parameter is a table-valued parameter)
- Selects
- SelectColumns
- Name
- DataTypes
- IsNullable
- SelectColumns
- Tables
Helps map a data type to similar datatypes in different environments. Created from this reference: https://msdn.microsoft.com/en-us/library/cc716729%28v=vs.110%29.aspx
Prevents a default instance of the class from being created.
Gets a single data type dictionary with values for each TypeFormat
Name | Description |
---|---|
dataType |
SqlSharpener.DataTypes Type of the data. |
Gets a single data type dictionary with values for each TypeFormat by finding the specified entry in the list of data type dictionaries.
Name | Description |
---|---|
lookupFormat |
SqlSharpener.TypeFormat The TypeFormat of the lookupValue parameter. |
lookupValue |
System.String The value to identify the dictionary to return. |
The first data type dictionary that contains the specified TypeFormat and value.
Gets the instance.
Converts the specified source data type into the specified destination data type.
Name | Description |
---|---|
sourceDataType |
System.String The source data type. For example bigint. |
sourceFormat |
SqlSharpener.TypeFormat The format of the the sourceDataType parameter. |
destinationFormat |
SqlSharpener.TypeFormat The format to convert the sourceDataType parameter to. |
The converted data type.
System.NotSupportedException:
Creates a model from the specified sql files.
Initializes a new instance of the class.
Name | Description |
---|---|
sqlPaths |
System.String[] The paths to the *.sql files. |
Creates a new TSqlModel, loads all *.sql files specified in the SqlPaths property into the new model, and then parses the model.
System.InvalidOperationException: No path to *.sql files exists in SqlPaths properties.
Parses the specified TSqlModel
Name | Description |
---|---|
model |
Microsoft.SqlServer.Dac.Model.TSqlModel The model. |
Creates a new TSqlModel, loads each specified sql statement into the new model, and then parses the model
Name | Description |
---|---|
sqlStatements |
System.String[] One or more sql statements to load, such as CREATE TABLE or CREATE PROCEDURE statements. |
Gets or sets the prefix to strip off the procedure name when generating the method name.
Objects representing the meta data parsed from stored procedures in the model.
List of directories where *.sql exist that should be added to the model.
Objects representing the meta data parsed from the tables in the model.
Objects representing the meta data parsed from the views in the model.
Represents a column in a table.
Constructor(Microsoft.SqlServer.Dac.Model.TSqlObject,Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.Dac.Model.TSqlObject},System.Collections.Generic.IDictionary{Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.TransactSql.ScriptDom.ForeignKeyConstraintDefinition}})
Initializes a new instance of the class.
Name | Description |
---|---|
tSqlObject |
Unknown type The TSqlObject representing the column. |
tSqlTable |
Unknown type The table or view this column belongs to. |
primaryKeys |
Unknown type The primary keys. |
foreignKeys |
Unknown type The foreign keys. |
Constructor(System.String,System.Collections.Generic.IDictionary{SqlSharpener.TypeFormat,System.String},System.Boolean,System.Boolean,System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Collections.Generic.IEnumerable{SqlSharpener.Model.RelationshipIdentifier},System.Collections.Generic.IEnumerable{SqlSharpener.Model.RelationshipIdentifier})
Initializes a new instance of the class.
Name | Description |
---|---|
name |
Unknown type The name. |
dataTypes |
Unknown type The data types. |
isIdentity |
Unknown type if set to true [is identity]. |
isNullable |
Unknown type if set to true [is nullable]. |
precision |
Unknown type The precision. |
scale |
Unknown type The scale. |
length |
Unknown type The length. |
isPrimaryKey |
Unknown type if set to true [is primary key]. |
isForeignKey |
Unknown type if set to true [is foreign key]. |
parentRelationships |
Unknown type The parent relationships. |
childRelationships |
Unknown type The child relationships. |
Gets or sets the relationships where this column is a foreign key on other tables.
Gets the data types.
Gets or sets a value indicating whether this instance is foreign key.
Gets or sets a value indicating whether this instance is an identity column.
Gets or sets a value indicating whether this instance is nullable.
Gets or sets a value indicating whether this instance is primary key.
Gets or sets the length.
Gets the name.
Gets or sets the relationships where this column is a foreign key.
Gets or sets the precision.
Gets or sets the scale.
Represents a parameter of a stored procedure.
Constructor(Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.Dac.Model.TSqlObject},System.Collections.Generic.IDictionary{Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.TransactSql.ScriptDom.ForeignKeyConstraintDefinition}})
Initializes a new instance of the class.
Name | Description |
---|---|
tSqlObject |
Unknown type The TSqlObject representing the parameter. |
primaryKeys |
Unknown type The primary keys. |
foreignKeys |
Unknown type The foreign keys. |
Constructor(System.String,System.Collections.Generic.IDictionary{SqlSharpener.TypeFormat,System.String},System.Boolean,SqlSharpener.Model.Table)
Initializes a new instance of the class.
Name | Description |
---|---|
name |
Unknown type The name. |
dataTypes |
Unknown type The data types. |
isOutput |
Unknown type if set to true [is output]. |
Gets the data types for this parameter.
Gets a value indicating whether this instance is an output parameter.
Gets the name.
Gets the table representing this parameter if it is a table variable parameter.
Represents a stored procedures
Constructor(Microsoft.SqlServer.Dac.Model.TSqlObject,System.String,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.Dac.Model.TSqlObject},System.Collections.Generic.IDictionary{Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.TransactSql.ScriptDom.ForeignKeyConstraintDefinition}})
Initializes a new instance of the class.
Name | Description |
---|---|
prefix |
Unknown type The prefix used on stored procedure names. |
Initializes a new instance of the class.
Name | Description |
---|---|
name |
System.String The name to use for methods. |
rawName |
System.String The raw name of the stored procedure. |
prefix |
System.String The prefix used on stored procedure names. |
parameters |
System.Collections.Generic.IEnumerable{SqlSharpener.Model.Parameter} The parameters. |
selects |
System.Collections.Generic.IEnumerable{SqlSharpener.Model.Select} The selects. |
Gets the name used for methods.
Gets the parameters.
Gets the prefix.
Gets the raw name of the stored procedure.
Gets the selects.
Represents a SELECT statement in a stored procedure.
Constructor(Microsoft.SqlServer.TransactSql.ScriptDom.QuerySpecification,System.Collections.Generic.IDictionary{System.String,SqlSharpener.DataType})
Initializes a new instance of the class.
Name | Description |
---|---|
querySpecification |
Unknown type The query specification. |
bodyColumnTypes |
Unknown type The body column types. |
Constructor(System.Collections.Generic.IEnumerable{SqlSharpener.Model.SelectColumn},System.Boolean,System.Collections.Generic.IDictionary{System.String,System.String})
Initializes a new instance of the class.
Name | Description |
---|---|
columns |
Unknown type The columns. |
isSingleRow |
Unknown type if set to true the select statement uses a TOP 1 clause or is a function call. |
tableAliases |
Unknown type The table aliases. |
Gets the columns.
Traverses the joins and gets a list of tables that have been outer joined.
Name | Description |
---|---|
outerJoinedTables |
System.Collections.Generic.List{System.String} The outer joined tables list. |
qualifiedJoin |
Microsoft.SqlServer.TransactSql.ScriptDom.QualifiedJoin The qualified join. |
isParentOuterJoined |
System.Boolean if set to true a parent join was outer joined. |
Gets a value indicating whether this SELECT uses a TOP 1 clause or is a function call.
Gets the table aliases.
Represents a column in a SELECT statement in a stored procedure.
Constructor(Microsoft.SqlServer.TransactSql.ScriptDom.SelectScalarExpression,System.Collections.Generic.IDictionary{System.String,SqlSharpener.DataType},System.Collections.Generic.IDictionary{System.String,System.String},System.Collections.Generic.IEnumerable{System.String})
Initializes a new instance of the class.
Name | Description |
---|---|
selectScalarExpression |
Unknown type The select scalar expression. |
bodyColumnTypes |
Unknown type The body column types. |
tableAliases |
Unknown type The table aliases. |
outerJoinedTables |
System.Collections.Generic.List{System.String} The aliases or names of tables that were outer joined. Used to determine if a non-nulllable column could still be null. |
System.InvalidOperationException: Could not find column within BodyDependencies: + fullColName
Constructor(System.String,System.Collections.Generic.IDictionary{SqlSharpener.TypeFormat,System.String},System.Boolean)
Initializes a new instance of the class.
Name | Description |
---|---|
name |
System.String The name or alias. |
dataTypes |
Unknown type The data types. |
isNullable |
Unknown type if set to true [is nullable]. |
Gets the data types.
GetFullColumnName(System.Collections.Generic.IDictionary{System.String,System.String},System.Collections.Generic.IList{Microsoft.SqlServer.TransactSql.ScriptDom.Identifier})
Gets the fully qualified column name with any table aliases resolved.
Name | Description |
---|---|
tableAliases |
Unknown type The table aliases. |
identifiers |
Unknown type The identifiers in the MultiPartIdentifier. |
The fully qualified column name.
Gets or sets a value indicating whether this instance is nullable.
Gets the name or alias.
Represents a table in the model.
Constructor(Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.Dac.Model.TSqlObject},System.Collections.Generic.IDictionary{Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.TransactSql.ScriptDom.ForeignKeyConstraintDefinition}})
Initializes a new instance of the class.
Name | Description |
---|---|
tSqlObject |
Unknown type The TSqlObject representing the table. |
primaryKeys |
Unknown type The primary keys. |
foreignKeys |
Unknown type The foreign keys. |
Initializes a new instance of the class.
Name | Description |
---|---|
name |
System.String The name of the table. |
columns |
System.Collections.Generic.IEnumerable{SqlSharpener.Model.Column} The columns. |
Gets the columns.
Gets the name of the table.
Represents a view in the model.
Constructor(Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.Dac.Model.TSqlObject},System.Collections.Generic.IDictionary{Microsoft.SqlServer.Dac.Model.TSqlObject,System.Collections.Generic.IEnumerable{Microsoft.SqlServer.TransactSql.ScriptDom.ForeignKeyConstraintDefinition}})
Initializes a new instance of the class.
Name | Description |
---|---|
tSqlObject |
Unknown type The TSqlObject representing the view. |
primaryKeys |
Unknown type The primary keys. |
foreignKeys |
Unknown type The foreign keys. |
Initializes a new instance of the class.
Name | Description |
---|---|
name |
System.String The name of the view. |
columns |
System.Collections.Generic.IEnumerable{SqlSharpener.Model.Column} The columns. |
Gets the columns.
Gets the name of the view.
Helper class to handle some of the more complex code generation.
Gets the DTO return objects that represent a row of each result set of each procedure.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The procedure to generate the DTO from. |
indent |
System.Int32 The number of tabs to indent the generated code. |
The generated DTO objects.
Gets the generated statement that executes the stored procedure and loads the results into the return variable.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The procedure to get the generated execute statement for. |
indent |
System.Int32 The number of tabs to indent the generated code. |
The generated code.
Gets the parameter list for the method.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The procedure to get the parameter list for. |
genericTableValue |
System.Boolean if set to true [generic table value]. |
includeType |
System.Boolean if set to true [include type]. |
convertType |
System.Boolean if set to true [convert type]. |
The generated parameter list.
Gets the method parameter list for methods that call an overload with input DTO properties as parameters.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The proc. |
Gets the method parameter list for object array.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The proc. |
Scrubs the outputNamespace parameter to ensure it is not null.
Name | Description |
---|---|
outputNameSpace |
System.String The outputNameSpace T4 parameter. |
The value of outputNameSpace if not null.
System.ArgumentNullException: outputNamespace cannot be null.
Gets the type of object the procedure's function will return.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The procedure to get the return type for. |
The generated return type.
Gets the variable declaration statement for the return value.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The procedure to get the return variable declaration statement. |
The generated declaration statement.
Gets the Xml comment to place in the <returns%gt; element.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The procedure to get the return variable declaration statement. |
The Xml comment
Gets the generated SqlParameter objects with assigned values.
Name | Description |
---|---|
proc |
SqlSharpener.Model.Procedure The procedure to get the generated SqlParameters for. |
indent |
System.Int32 The number of tabs to indent the generated code. |
The generated SqlParameters
Class to produce the template output
Initialize the template
Access the outputNamespace parameter of the template.
Access the procedurePrefix parameter of the template.
Access the sqlPaths parameter of the template.
Create the template output
The different types of datatypes available.
The database type enum
The dot net framework type
The SQL data reader database type
The SQL data reader SQL type
The SqlDbTypeEnum type
The SQL server database type