Exemplo n.º 1
0
        public IDictionary <string, IStorageContext> GenerateStorageContexts <T>(string rountingName, int top,
                                                                                 IFilterCondition[] where,
                                                                                 IOrderByCondition[] orderby)
            where T : class, IAlbianObject, new()
        {
            IDictionary <string, IStorageContext> storageContexts = new Dictionary <string, IStorageContext>();
            IFakeCommandBuilder   fakeBuilder           = new FakeCommandBuilder();
            IFakeCommandAttribute fakeCommandAttrribute = fakeBuilder.GenerateQuery <T>(rountingName, top, where, orderby);

            if (null == fakeCommandAttrribute) //the PermissionMode is not enough
            {
                if (null != Logger)
                {
                    Logger.WarnFormat("The permission is not enough in the {0} routing.", rountingName);
                }
                throw new PersistenceException(string.Format("The permission is not enough in the {0} routing.",
                                                             rountingName));
            }

            IStorageContext storageContext = new StorageContext
            {
                FakeCommand = new List <IFakeCommandAttribute>(),
                StorageName = fakeCommandAttrribute.StorageName,
            };

            storageContext.FakeCommand.Add(fakeCommandAttrribute);
            storageContexts.Add(fakeCommandAttrribute.StorageName, storageContext);
            return(storageContexts);
        }