public void CorrectInference() { Kernel.AddComponent( "typeinf", typeof(ITypeInferenceService), typeof(TypeInferenceService) ); ITypeInferenceService typeInf = Kernel[ typeof(ITypeInferenceService) ] as ITypeInferenceService; Assert.AreEqual( typeof(String), typeInf.ConvertOleType( OleDbType.VarChar ) ); Assert.AreEqual( typeof(int), typeInf.ConvertOleType( OleDbType.Integer ) ); }
public ActiveRecordPropertyDescriptor[] InferProperties(TableDefinition tableDef) { ArrayList list = new ArrayList(); foreach (ColumnDefinition col in tableDef.Columns) { if (col.ForeignKey) { continue; } String propertyName = _namingService.CreatePropertyName(col.Name); Type propertyType = _typeInfService.ConvertOleType(col.Type); String colType = col.Type.ToString(); String colName = col.Name; ActiveRecordFieldDescriptor field = null; if (col.PrimaryKey) { field = new ActiveRecordPrimaryKeyDescriptor( colName, colType, propertyName, propertyType, "Native"); } else { field = new ActiveRecordFieldDescriptor( colName, colType, propertyName, propertyType, col.Nullable); } list.Add(field); } return((ActiveRecordFieldDescriptor[])list.ToArray(typeof(ActiveRecordFieldDescriptor))); }