private void BindValue(PropertyMap aMap, SqlDataReader aReader, Object aData) { try { int ordinal = aReader.GetOrdinal(aMap.GetColumn()); var value = aReader.IsDBNull(ordinal) ? null : aReader[ordinal]; ValueExtractor.SetValue(aMap.Member.Name, aData, value); } catch (IndexOutOfRangeException) { } }
public void Insert <T>(T aModel, bool isNullBind) where T : class, new() { InsertQuery <T> query = QueryFactory.CreateInsertQuery <T>(aModel, isNullBind); IdentityMap identity = Loader.GetClassMap <T>().Identity; ResultBinder <T> binder = new TemplateInsertBinder <T>(); binder.OnBind = delegate(T anEntity) { String id = identity.Member.Name; ValueExtractor.SetValue(id, aModel, ValueExtractor.GetValue(id, anEntity)); }; Connetion.execute(query, binder); }