Using Dapper to Insert into a Table with Default Values

I have a table that has a field that is not null and has a default value defined[CreatedOn] not null default(getdate())The the property I use in the model for dapper is a nullable DateTimepublic DateTime? CreatedOn { get; set; }If I try to insert, an exception is thrown for trying to insert an null value in a not null<MyObject>(obj); //Throws because CreatedOn == nullWhat I'm looking for is the default to be set by the database, and to still be able to see that value when I read objects. Because Dapper is passing the value...Read more

DapperExtensions and Dapper.Contrib with non-dbo Schema

I'm using DapperExtensions v4.0.30319 and I'm trying to let Dapper.Contrib know that my schema is not DBO. I have provided:public class EngineMapper : ClassMapper<Engine>{ public EngineMapper() : base() { Schema("vehicles"); }}I understand from the DapperExtensions documentation ( that this class will be automatically found using reflection?But I also tried explicitly using:DapperExtensions.DapperExtensions.DefaultMapper = typeof(EngineMapper)...Read more

Dapper Extensions for Date comparision using Predicate

How do you compare the date values using predicate groupthis is what I have been trying to do var predicateGroup = new PredicateGroup { Operator = GroupOperator.And, Predicates = new List<IPredicate>() }; predicateGroup.Predicates.Add(Predicates.Field<Contents>(f => f.Guid, Operator.Eq, staticContents.Guid)); predicateGroup.Predicates.Add(Predicates.Field<Contents>(f => f.StartDate, Operator.Ge, DateTime.UtcNow)); predicateGroup.Predicates.Add(Predicates.Field<Contents>(f => f.EndDate, Operator.Le, D...Read more

dapper extensions - Dapperextension mapping functionality

Is there a way with the dapperexstension mapping to map an object to a value (id) when the object is a property of another object. Here is an example.public class Contact{ public int Id { get; set; } public string Name { get; set; } public Address Address { get; set; }}public class Address{ public int Id { get; set; } public string Street { get; set; }}The table in the database for Contact will have this 3 columnsId NameAddressIdSo when I save the Contact with the connection.Insert<> function I want the Address be converted to...Read more