// This method is called on Import-Module. public void OnImport() { if (_called) { return; } _called = true; BsonSerializer.RegisterSerializer(typeof(Collection), new CollectionSerializer()); BsonSerializer.RegisterSerializer(typeof(Dictionary), new DictionarySerializer()); BsonSerializer.RegisterSerializer(typeof(PSObject), new PSObjectSerializer()); BsonTypeMapper.RegisterCustomTypeMapper(typeof(PSObject), new PSObjectTypeMapper()); var strGuidRepresentation = Environment.GetEnvironmentVariable("Mdbc_GuidRepresentation"); if (strGuidRepresentation == null) { BsonDefaults.GuidRepresentation = GuidRepresentation.Standard; } else { if (Enum.TryParse(strGuidRepresentation, out GuidRepresentation valGuidRepresentation)) { BsonDefaults.GuidRepresentation = valGuidRepresentation; } else { throw new InvalidOperationException($"Invalid environment variable Mdbc_GuidRepresentation = {strGuidRepresentation}"); } } }
// This method should be called as soon as possible. Multiple calls are allowed. public static void Register() { if (_registered) { return; } _registered = true; BsonSerializer.RegisterSerializer(typeof(Dictionary), new DictionarySerializer()); BsonSerializer.RegisterSerializer(typeof(LazyDictionary), new LazyDictionarySerializer()); BsonSerializer.RegisterSerializer(typeof(RawDictionary), new RawDictionarySerializer()); BsonSerializer.RegisterSerializer(typeof(PSObject), new PSObjectSerializer()); BsonTypeMapper.RegisterCustomTypeMapper(typeof(PSObject), new PSObjectTypeMapper()); var strGuidRepresentation = Environment.GetEnvironmentVariable("Mdbc_GuidRepresentation"); if (strGuidRepresentation == null) { BsonDefaults.GuidRepresentation = GuidRepresentation.Standard; } else { GuidRepresentation valGuidRepresentation; if (Enum.TryParse(strGuidRepresentation, out valGuidRepresentation)) { BsonDefaults.GuidRepresentation = valGuidRepresentation; } else { throw new InvalidOperationException(String.Format(null, "Invalid environment variable Mdbc_GuidRepresentation = {0}", strGuidRepresentation)); } } }
public static void Register(Type type) { if (_registrations.Contains(type)) { return; } BsonTypeMapper.RegisterCustomTypeMapper( type, new EventStoreIdentityCustomBsonTypeMapper() ); _registrations.Add(type); }
public static void Register(Type type) { if (_registrations.Contains(type)) { return; } BsonTypeMapper.RegisterCustomTypeMapper( type, new StringValueCustomBsonTypeMapper() ); _registrations.Add(type); }
// This method should be called as soon as possible. Multiple calls are allowed. public static void Register() { if (_registered) { return; } _registered = true; BsonSerializer.RegisterSerializer(typeof(Dictionary), new DictionarySerializer()); BsonSerializer.RegisterSerializer(typeof(LazyDictionary), new LazyDictionarySerializer()); BsonSerializer.RegisterSerializer(typeof(RawDictionary), new RawDictionarySerializer()); BsonSerializer.RegisterSerializer(typeof(PSObject), new PSObjectSerializer()); BsonTypeMapper.RegisterCustomTypeMapper(typeof(PSObject), new PSObjectTypeMapper()); }
static CustomDateTime() { BsonTypeMapper.RegisterCustomTypeMapper(typeof(CustomDateTime), new CustomDateTimeMapper()); }
public override void Setup(Settings <T> statements) { _statements = statements; var statementsConnectionString = _statements.ConnectionString ?? "mongodb://*****:*****@{server} - REGISTERING", Message.EContentType.StartupSequence); _statements = Info <T> .Settings; _tabledata = Info <T> .Configuration; if (_tabledata.IgnoreEnvironmentPrefix != true) { _collectionPrefix = $"{_statements.EnvironmentCode}."; } RegisterGenericChain(typeof(T)); SetBaseCollectionName(); }