private void SetCommonConfiguration(ICommonConfiguration configuration, bool weakReferences) { ConfigGenerator.GetConfigFromAttributes(configuration, _entitityTypes. Select(kv => kv.Key).ToList()); configuration.ActivationDepth = 0; configuration.StringEncoding = StringEncodings.Unicode(); configuration.WeakReferences = weakReferences; configuration.WeakReferenceCollectionInterval = 1000; }
public const int ProductsDefaultActivationDepth = 0; //I want control activation depth manualy /// <summary> /// Returns IServerConfiguration for the Products database. /// You have to define this method in dbo, web.config section /// </summary> /// <returns></returns> public static IServerConfiguration GetProductsConfiguration() { var databaseConfig = Db4oClientServer.NewServerConfiguration(); ConfigGenerator.GetConfigFromAttributes(databaseConfig.Common, new Collection <Type> { typeof(Product), typeof(Category) }); databaseConfig.Common.ActivationDepth = ProductsDefaultActivationDepth; databaseConfig.Common.StringEncoding = StringEncodings.Unicode(); databaseConfig.Common.WeakReferences = false; databaseConfig.File.DisableCommitRecovery(); return(databaseConfig); }
private IEmbeddedConfiguration GetEmbeddedConfiguration() { var clientConfig = Db4oEmbedded.NewConfiguration(); ConfigGenerator.GetConfigFromAttributes(clientConfig.Common, _entitityTypes); clientConfig.Common.ActivationDepth = 0; clientConfig.Common.StringEncoding = StringEncodings.Unicode(); clientConfig.Common.WeakReferences = UseWeakReferencesInProcess; if (UseMemoryStorageInProcess) { clientConfig.File.Storage = new PagingMemoryStorage(); } return(clientConfig); }