1
Vote

Timestamp support...

description

We added support for TimeStamp datatype in DapperSQLinq (because that is what we are using).
As you know timestamp values cannot be uppdated or inserted in normal ways, because its generated inside the database.
So we are ignoring this column when updating and inserting into database.
We are not sure that we got all parts we have changed, but perhaps you get the point.

DapperAccessPrincipal.patml

Inside these three sections:
<PatternContent Name="InsertParametersName" ConditionKeyMode="FieldsKeyTypeAll">

<PatternContent Name="InsertParametersValue" ConditionKeyMode="FieldsKeyTypeAll">

<PatternContent Name="PrimaryKeyParameters" ConditionKeyMode="FieldsKeyTypeAll">
We added this:
<Condition Key="TimestampType"></Condition>

DapperEntityPrincipal.patml

Added a section for TimeStampType:
<Condition Key="TimestampType">
<![CDATA[                                                                       
/// <summary>
/// [:FieldDescription:]
/// </summary>
[Display(Name = "[:FieldDescription:]")]
[SQLinqColumn("[:FieldNameDb:]")]
public [:FieldDotNetType:] [:FieldName:] { get; set; }
]]>
</Condition>                           

Schema\Patterns\Definations.cs

Inside this class:
public static class FieldKeyType
Added this:
public const string TimestampType = "TimestampType";
Please observe the spelling of the Defin(a/i)tions... (please check your spelling) :-)

Thanks again for a really good product...

comments

salar2k wrote Aug 13, 2013 at 7:16 AM

It's not only the patterns that should change. The Generator.cs should change too.

in order to do so change the following things:

*- new type for PatternConditionKeyMode.FieldCondensedType
*- update DotNetSchemaDataInfo.DetermineColumnCondensedType method
*- update ConditionItem_AppliesToColumn in Generator.cs file
*- then in patterns use FieldCondensedType or FieldsCondensedTypeAll to specify the new type. It's conditions would be None, String, Integer, Decimal and Timestamp