/// <summary> /// Serialise the current object type. /// </summary> /// <typeparam name="T">The type to examine.</typeparam> /// <param name="source">The current source object type.</param> /// <returns>The byte array of serialised data.</returns> public static byte[] SerialiseDataEntity <T>(this T source) where T : class, new() { GenericSerialisation <T> seril = new GenericSerialisation <T>(); return(seril.Serialise(source)); }
/// <summary> /// Get the current SHA1 hashcode for the data type /// </summary> /// <typeparam name="TData">The data type to examine</typeparam> /// <param name="data">The data to get the hash code for.</param> /// <returns>The hash code for the data.</returns> public static string GetHashCode <TData>(TData data) { GenericSerialisation <TData> serialise = new GenericSerialisation <TData>(); string xml = System.Text.Encoding.UTF8.GetString(serialise.Serialise(data)); string hashCode = Nequeo.Cryptography.Hashcode.GetHashcodeSHA1(xml); return(hashCode); }
/// <summary> /// Serialise the current object type. /// </summary> /// <typeparam name="T">The type to examine.</typeparam> /// <param name="source">The current source object type.</param> /// <returns>The byte array of serialised data.</returns> public static byte[] SerialiseXml <T>(this T source) { GenericSerialisation <T> seril = new GenericSerialisation <T>(); return(seril.Serialise(source)); }