public Parameter(string parameterName, object Value, MyDataType dbType, ParameterDirection paramDirection) { this.m_name = parameterName; this.m_dbType = dbType; this.m_value = Value; this.m_direction = paramDirection; }
static MyDataType RandomType(System.Random random) { int a = random.Next(0, 4); MyDataType v = (MyDataType)a; //转枚举 return(v); }
public RecordDataParameter(string number, string name, MyDataType type, string person, int accessory, string operation) { this.number = number; this.name = name; this.type = type; this.person = person; this.accessory = accessory; this.operation = operation; }
public void DataTypeVisitor_Custom() { var v = new MyVisitor(); var d = new MyDataType(); var e = v.Visit(d); Assert.ThrowsException <NotImplementedException>(() => _ = new DataTypeVisitor().Visit(d)); Assert.AreSame(d, e); Assert.AreEqual(d.ToString(), e.ToString()); }
public Parameter(string parameterName, MyDataType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object Value) { this.m_name = parameterName; this.m_dbType = dbType; this.m_size = size; this.m_direction = direction; this.m_isNullable = isNullable; this.m_precision = precision; this.m_scale = scale; this.m_sourceColumn = sourceColumn; this.m_version = sourceVersion; this.m_value = Value; }
public void DataTypeVisitor_Generic_Simple() { var v = new GenericVisitor(); Assert.IsNull(v.Visit(type: null)); foreach (var t in new[] { typeof(int), typeof(int[]), typeof(Func <int, int>), }) { var d = DataType.FromType(t); var r = v.Visit(d); Assert.AreEqual(t, r, t.ToString()); } var c = new MyDataType(); Assert.AreSame(c.UnderlyingType, v.Visit(c)); v.Test(); }
public Parameter(string parameterName, MyDataType dbType, int size) { this.m_name = parameterName; this.m_dbType = dbType; this.m_size = size; }
internal void SetProperties(string name, string column, DataRowVersion version, byte precision, byte scale, int size, bool forceSize, int offset, ParameterDirection direction, object Value, MyDataType type, bool suppress) { this.ParameterName = name; this.m_sourceColumn = column; this.SourceVersion = version; this.Precision = precision; this.m_scale = scale; this.m_size = size; this.m_forceSize = forceSize; this.m_offset = offset; this.Direction = direction; if (Value is ICloneable) { Value = ((ICloneable) Value).Clone(); } this.m_value = Value; this.Suppress = suppress; }
public MyStruct(MyDataType tType, Object oDest) { type = tType; objDest = oDest; }
public static object GetMyDataType(MyDataType mdt, DataConfig _config) { new object(); switch (mdt) { case MyDataType.Int: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Number; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Integer; } return SqlDbType.Int; case MyDataType.Int16: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Int16; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Single; } return SqlDbType.SmallInt; case MyDataType.Int32: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Int32; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.BigInt; } return SqlDbType.BigInt; case MyDataType.Double: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Double; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Double; } return SqlDbType.Real; case MyDataType.Float: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Float; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Currency; } return SqlDbType.Float; case MyDataType.Number: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Number; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Numeric; } return SqlDbType.Decimal; case MyDataType.Money: if (_config.DatabaseType == DataBaseType.Oracle) { throw new Exception("Oracle中无此参数类型"); } if (_config.DatabaseType != DataBaseType.SqlServer) { throw new Exception("OleDb中无此参数类型"); } return SqlDbType.Float; case MyDataType.SmallMoney: if (_config.DatabaseType == DataBaseType.Oracle) { throw new Exception("Oracle中无此参数类型"); } if (_config.DatabaseType != DataBaseType.SqlServer) { throw new Exception("OleDb中无此参数类型"); } return SqlDbType.SmallMoney; case MyDataType.Char: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Char; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Char; } return SqlDbType.Char; case MyDataType.VarChar: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.VarChar; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.VarChar; } return SqlDbType.VarChar; case MyDataType.NVarChar: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.NVarChar; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.VarChar; } return SqlDbType.NVarChar; case MyDataType.Clob: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Clob; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.LongVarChar; } return SqlDbType.Text; case MyDataType.NChar: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.NChar; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.BSTR; } return SqlDbType.NChar; case MyDataType.NClob: if (_config.DatabaseType != DataBaseType.Oracle) { if (_config.DatabaseType != DataBaseType.SqlServer) { throw new Exception("OleDb中无此参数类型"); } return SqlDbType.NText; } return OracleType.NClob; case MyDataType.DateTime: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.DateTime; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Date; } return SqlDbType.DateTime; case MyDataType.Timestamp: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Timestamp; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.DBTimeStamp; } return SqlDbType.Timestamp; case MyDataType.Boolean: if (_config.DatabaseType == DataBaseType.Oracle) { throw new Exception("Oracle中无此参数类型"); } if (_config.DatabaseType == DataBaseType.SqlServer) { return SqlDbType.Bit; } return OleDbType.Boolean; case MyDataType.Blob: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Blob; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.LongVarBinary; } return SqlDbType.Image; case MyDataType.Byte: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Byte; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Binary; } return SqlDbType.TinyInt; case MyDataType.Raw: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.Raw; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Binary; } return SqlDbType.Binary; case MyDataType.RowId: if (_config.DatabaseType == DataBaseType.Oracle) { return OracleType.RowId; } if (_config.DatabaseType != DataBaseType.SqlServer) { return OleDbType.Guid; } return SqlDbType.UniqueIdentifier; case MyDataType.Cursor: if (_config.DatabaseType != DataBaseType.Oracle) { if (_config.DatabaseType == DataBaseType.SqlServer) { throw new Exception("SqlServer无此参数类型"); } throw new Exception("OleDb无此参数类型"); } return OracleType.Cursor; } throw new Exception("QxRoom类库未知的参数类型"); }
static void Main(string[] args) { // 解决控制台中文乱码 //Console.OutputEncoding = Encoding.GetEncoding(936); // 常量 //const double PI = 3.14159; const string Const_Str = "Welcome to the C# Wrold."; Console.WriteLine(Const_Str); //Console.WriteLine(PI); // Array.cs //MyArray ar = new MyArray(); var ar = new MyArray(); ar.Run(); //ReferenceTypes Rer = new ReferenceTypes(); //Rer.DynamicType(); // Enum.cs MyEnum e = new MyEnum(); e.Run(); // Interface.cs MyInterface Inter = new MyInterface(); Inter.Run(); // Method.cs MyMethod Met = new MyMethod(); Met.Run(); // Operators.cs MyOperators OP = new MyOperators(); OP.Run(); // RegularExpression.cs 正则表达式 MyRegularExpression RE = new MyRegularExpression(); RE.Run(); // StringTest.cs MyString str = new MyString(); str.Run(); // StrucTest.cs MyStruc st = new MyStruc(); st.Run(); // VariAblesConst.cs InputCustomers i = new InputCustomers(); i.InputCustomer("Please input Int:"); // NameSpace.cs MyNameSpace NS = new MyNameSpace(); NS.Run(); // DataTypes.cs MyDataType DT = new MyDataType(); DT.Run(); // MultipleInherit.cs InheritClass02 Inh02 = new InheritClass02(); Inh02.Run(); // RectangleText RT = new RectangleText(10, 20); // Polymorphism.cs MyPolymorphism PP = new MyPolymorphism(); PP.Run(); // FilesTest.cs MyFiles file = new MyFiles(); file.Run(); // DirectoryTest.cs MyDirectory Dir = new MyDirectory(); Dir.Run(); // AttributeTest.cs MyAttributes AB = new MyAttributes(); AB.Run(); // PropertyTest.cs MyProperty pp = new MyProperty(); pp.Run(); // IndexerTest.cs var id = new MyIndexer(5); id.Run(); // DelegateTest.cs var DL = new MyDelegate(); DL.Run(); // MyEvent ee = new MyEvent(); ee.Run(); // CollectionTest.cs MyCollection cc = new MyCollection(); cc.Run(); #region 预处理指令 // #define 定义一个符号,这个符号会作为一个表达式传递给 #if 指令,这个判断会得到 ture 的 结果。 //#if (PI) // Console.WriteLine("PI is defined"); //#else // Console.WriteLine("PI is not defined"); //#endif //#if (DEBUG && !VC_V10) // Console.WriteLine("DEBUG is defined"); //#elif (!DEBUG && VC_V10) // Console.WriteLine("VC_V10 is defined"); //#elif (DEBUG && VC_V10) // Console.WriteLine("DEBUG and VC_V10 are defined"); //#else // Console.WriteLine("DEBUG and VC_V10 are not defined"); //#endif #endregion // RandomNumber.cs MyRandom rd = new MyRandom(); rd.Run(); // MyTest tt = new MyTest(); tt.Test(); Console.ReadKey(); }
public TypeDescriptor(MyDataType dataType) { _dataType = dataType; }
public Parameter Add(string ParameterName, object Value, MyDataType dbType, ParameterDirection paramDirection, int size) { return this.Add(new Parameter(ParameterName, Value, dbType, paramDirection, size)); }