public void AddType(Type tRecord) { iTypeSerializer ts = m_serializer.FindSerializerForType(tRecord); if (null == ts) { m_serializer.AddSerializedType(tRecord); ts = m_serializer.FindSerializerForType(tRecord); } this.addType(ts as TypeSerializer, false); }
public void AddType(Type tRecord) { if (isInTransaction) { throw new NotSupportedException("Can't add serialized types from within a transaction."); // Because the DB engine will close tables when the transaction ends } iTypeSerializer ts = m_serializer.FindSerializerForType(tRecord); if (null == ts) { m_serializer.AddSerializedType(tRecord); ts = m_serializer.FindSerializerForType(tRecord); } this.addType(ts as TypeSerializer, false); }
/// <summary>Get type serializer for the specified record type.</summary> /// <remarks>If called before the first sessions is created, this will create a new session, potentially triggering schema update.</remarks> public iTypeSerializer serializerForType <tRecord>() { lock (this.syncRoot) { if (m_allSessions.Count > 0) { return(m_serializer.FindSerializerForType(typeof(tRecord))); } using (var sess = GetSession()) return(sess.serializer.FindSerializerForType(typeof(tRecord))); } }