C# Class Pilgrim.Providers.TypeNames

This class maps a DbType to names.
Associations may be marked with a capacity. Calling the Get() method with a type and actual size n will return the associated name with smallest capacity >= n, if available and an unmarked default type otherwise. Eg, setting Names.Put(DbType, "TEXT" ); Names.Put(DbType, 255, "VARCHAR($l)" ); Names.Put(DbType, 65534, "LONGVARCHAR($l)" ); will give you back the following: Names.Get(DbType) // --> "TEXT" (default) Names.Get(DbType,100) // --> "VARCHAR(100)" (100 is in [0:255]) Names.Get(DbType,1000) // --> "LONGVARCHAR(1000)" (100 is in [256:65534]) Names.Get(DbType,100000) // --> "TEXT" (default) On the other hand, simply putting Names.Put(DbType, "VARCHAR($l)" ); would result in Names.Get(DbType) // --> "VARCHAR($l)" (will cause trouble) Names.Get(DbType,100) // --> "VARCHAR(100)" Names.Get(DbType,1000) // --> "VARCHAR(1000)" Names.Get(DbType,10000) // --> "VARCHAR(10000)"
ファイルを表示 Open project: juanplopes/pilgrim

Public Methods

Method Description
Get ( DbType typecode ) : string

Get default type name for specified type

Get ( DbType typecode, int size, int precision, int scale ) : string

Get the type name specified type and size

Put ( DbType typecode, int capacity, string value ) : void

Set a type name for specified type key and capacity

Put ( DbType typecode, string value ) : void

Private Methods

Method Description
Replace ( string type, int size, int precision, int scale ) : string

Method Details

Get() public method

Get default type name for specified type
public Get ( DbType typecode ) : string
typecode DbType the type key
return string

Get() public method

Get the type name specified type and size
public Get ( DbType typecode, int size, int precision, int scale ) : string
typecode DbType the type key
size int the SQL length
precision int the SQL precision
scale int the SQL scale
return string

Put() public method

Set a type name for specified type key and capacity
public Put ( DbType typecode, int capacity, string value ) : void
typecode DbType the type key
capacity int the (maximum) type size/length
value string The associated name
return void

Put() public method

public Put ( DbType typecode, string value ) : void
typecode DbType
value string
return void