コード例 #1
0
 /// <summary>
 /// Fills the base simple object fields.
 /// </summary>
 /// <param name="baseObj">The base object.</param>
 /// <param name="sqlDataReader">The SQL data reader.</param>
 protected static void FillSimpleBaseObjectFields(ISimpleBaseObject baseObj, SqlDataReader sqlDataReader)
 {
     if (baseObj != null)
     {
         baseObj.LastUpdatedStamp = sqlDataReader[column_LastUpdatedStamp].ObjectToDateTime();
         baseObj.State            = (ObjectState)(sqlDataReader[column_State].ObjectToInt32());
         baseObj.Key          = sqlDataReader[column_Key].ObjectToGuid();
         baseObj.CreatedStamp = sqlDataReader[column_CreatedStamp].ObjectToDateTime();
     }
 }
コード例 #2
0
        /// <summary>
        /// Rebuilds the output object.
        /// </summary>
        /// <param name="lastModifiedSinceStamp">The last modified since stamp.</param>
        /// <param name="data">The data.</param>
        /// <param name="httpStatusCode">The HTTP status code.</param>
        /// <param name="noBody">if set to <c>true</c> [no body].</param>
        /// <param name="lastModifiedStamp">The last modified stamp.</param>
        /// <returns>System.Object.</returns>
        public object RebuildOutputObject(DateTime?lastModifiedSinceStamp, object data, ref int httpStatusCode, ref bool noBody, out DateTime?lastModifiedStamp)
        {
            ISimpleBaseObject simpleObject = data as ISimpleBaseObject;

            if (simpleObject != null)
            {
                return(InternalRebuildOutputObject(lastModifiedSinceStamp, simpleObject, ref httpStatusCode, ref noBody, out lastModifiedStamp));
            }

            lastModifiedStamp = null;
            return(data);
        }
コード例 #3
0
        public void LoneInterfaceFailsTest()
        {
            var obj = new SimpleBaseObject {
                BaseFieldInt = 1, BasePropInt = 3
            };

            var str = _serializer.Serialize(obj);

            Console.WriteLine(str);

            Assert.Throws <DeserializationException>(() =>
            {
                ISimpleBaseObject strDeserialized = _deserializer.Deserialize <ISimpleBaseObject>(str);
            });
        }