Ejemplo n.º 1
0
        static Service1()
        {
            string        connectionString = MSSqlConnectionProvider.GetConnectionString("localhost", "ServiceDB");
            IDataStore    dataStore        = XpoDefault.GetConnectionProvider(connectionString, AutoCreateOption.DatabaseAndSchema);
            DataCacheRoot dataCacheRoot    = new DataCacheRoot(dataStore);

            dataCacheRoot.Configure(new DataCacheConfiguration(DataCacheConfigurationCaching.InList, "Customer"));
            MainDataStore = dataCacheRoot;
        }
Ejemplo n.º 2
0
        protected override IDataLayer CreateDataLayer(IDataStore workingDataStore)
        {
            var cacheRoot = new DataCacheRoot(workingDataStore);
            var cacheNode = new DataCacheNode(cacheRoot);

            //下面这种方式是仅用 PmsOrder表、EdsProd表
            //var cfg = new DataCacheConfiguration(DataCacheConfigurationCaching.InList, "PmsOrder","EdsProd");
            //下面的方式是关闭除指定的。其他的,都启用。
            var cfg = new DataCacheConfiguration(DataCacheConfigurationCaching.NotInList, "Online", "OnlineItem");

            cacheRoot.Configure(cfg);
            //可以自己选用一种方式,然后开启上面这行

            if (this.threadSafe)
            {
                return(new ThreadSafeDataLayer(this.XPDictionary, cacheNode, new Assembly[0]));
            }
            return(new SimpleDataLayer(this.XPDictionary, cacheNode));
        }