static Func <DataReader, K> GetReader() { var reader = Expression.Parameter(typeof(DataReader)); return(Expression.Lambda <Func <DataReader, K> >(Serializers.ReadValue(reader, typeof(K)), reader).Compile()); }
/// <summary> /// Registers static serialization extension before any DbInstance initialization. /// Serialization extensions is a static class with following methods pattern: /// public static K ReadXXX(DataReader reader) /// public static void WriteXXX(DataWriter writer, K value) /// where K is custom type to serialize /// XXX is type name of K without namespace /// </summary> /// <typeparam name="K">Type to serialize</typeparam> /// <typeparam name="S">Serialization extension</typeparam> /// <param name="streamId">Stable (for the lifetime of your app) id of the custom type. /// Must be greater than 1000 (other are already taken or reserved for future use)</param> public static void RegisterType <K, S>(short streamId) { Serializers.RegisterType <K, S>(streamId); }