当前位置: 首页>>代码示例>>C#>>正文


C# Models.GetRepository方法代码示例

本文整理汇总了C#中Models.GetRepository方法的典型用法代码示例。如果您正苦于以下问题:C# Models.GetRepository方法的具体用法?C# Models.GetRepository怎么用?C# Models.GetRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Models的用法示例。


在下文中一共展示了Models.GetRepository方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Delete

 public void Delete(Models.MediaContent content)
 {
     string sql = string.Format("DELETE FROM {0} WHERE [email protected]", content.GetRepository().GetMediaContentTableName());
     SqlCeCommand command = new SqlCeCommand();
     command.CommandText = sql;
     command.Parameters.Add(new SqlCeParameter("UUID", content.UUID));
     SQLCeHelper.ExecuteNonQuery(content.GetRepository().GetConnectionString(), command);
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:8,代码来源:MediaContentProvider.cs

示例2: ClearCategories

        public void ClearCategories(Models.TextContent content)
        {
            var bucket = content.GetRepository().GetClient();

            var view = bucket.GetView(content.GetRepository().GetDefaultViewDesign(), "CategorisData_By_ContentUUID").Stale(StaleMode.False).Reduce(false);
            var ret = view.Where(it => it.Info["value"].ToString().Equals(content.UUID)).Select(it => it.ItemId);
            ret.ForEach((key, index) =>
            {
                bucket.Remove(key);
            });
        }
开发者ID:Godoy,项目名称:CMS,代码行数:11,代码来源:TextContentProvider.cs

示例3: Update

 public void Update(Models.MediaContent @new, Models.MediaContent old)
 {
     ((IPersistable)@new).OnSaving();
     string sql = string.Format("UPDATE {0} SET FolderName = @FolderName,FileName = @FileName,[email protected]) WHERE [email protected]"
         , @new.GetRepository().GetMediaContentTableName());
     SqlCeCommand command = new SqlCeCommand();
     command.CommandText = sql;
     command.Parameters.Add(new SqlCeParameter("UUID", @new.UUID));
     command.Parameters.Add(new SqlCeParameter("FolderName", @new.FolderName));
     command.Parameters.Add(new SqlCeParameter("FileName", @new.FileName));
     command.Parameters.Add(new SqlCeParameter("VirtualPath", @new.VirtualPath));
     SQLCeHelper.ExecuteNonQuery(@new.GetRepository().GetConnectionString(), command);
     ((IPersistable)@new).OnSaved();
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:14,代码来源:MediaContentProvider.cs

示例4: Add

 public void Add(Models.MediaContent content)
 {
     ((IPersistable)content).OnSaving();
     string sql = string.Format("INSERT INTO {0}(UUID,FolderName,FileName,VirtualPath,UserId) VALUES(@UUID,@FolderName,@FileName,@VirtualPath,@UserId)"
         , content.GetRepository().GetMediaContentTableName());
     SqlCeCommand command = new SqlCeCommand();
     command.CommandText = sql;
     command.Parameters.Add(new SqlCeParameter("UUID", content.UUID));
     command.Parameters.Add(new SqlCeParameter("FolderName", content.FolderName));
     command.Parameters.Add(new SqlCeParameter("FileName", content.FileName));
     command.Parameters.Add(new SqlCeParameter("VirtualPath", content.VirtualPath));
     command.Parameters.Add(new SqlCeParameter("UserId", content.UserId));
     SQLCeHelper.ExecuteNonQuery(content.GetRepository().GetConnectionString(), command);
     ((IPersistable)content).OnSaved();
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:15,代码来源:MediaContentProvider.cs

示例5: Generate

        public override string Generate(Models.ContentBase content)
        {
            string userKey = content.UserKey;
            if (string.IsNullOrEmpty(userKey))
            {
                userKey = GetColumnValueForUserKey(content);
            }
            if (string.IsNullOrEmpty(userKey))
            {
                userKey = content.UUID;
            }
            else
            {
                string sperator = content.GetRepository().AsActual().UserKeyHyphens;
                userKey = PinyinConverter.GetPinyin(userKey, sperator);
                if (userKey.Length > 256)
                {
                    userKey = userKey.Substring(0, 256);
                }
                var tmpUserKey = EscapeUserKey(content, userKey);

                int tries = 0;
                while (IfUserKeyExists(content, tmpUserKey))
                {
                    tries++;
                    tmpUserKey = userKey + sperator + tries.ToString();
                }
                userKey = tmpUserKey;
            }

            return userKey;
        }
开发者ID:Qupy,项目名称:Extensions,代码行数:32,代码来源:UserKeyGenerator.cs

示例6: ClearCategories

 public void ClearCategories(Models.TextContent content)
 {
     //((IPersistable)content).OnSaving();
     MongoCollection<BsonDocument> collection = content.GetRepository().GetCategoriesCollection();
     var query = new QueryDocument { { "ContentUUID", content.UUID } };
     collection.Remove(query);
     //((IPersistable)content).OnSaved();
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:8,代码来源:TextContentProvider.cs

示例7: Delete

 public void Delete(Models.TextContent content)
 {
     var database = content.GetRepository().GetDatabase();
     MongoCollection<BsonDocument> collection = database.GetCollection(content.GetSchema().GetSchemaCollectionName());
     var query = new QueryDocument { { "UUID", content.UUID } };
     collection.Remove(query);
     TextContentFileHelper.DeleteFiles(content);
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:8,代码来源:TextContentProvider.cs

示例8: DeleteCategories

        public void DeleteCategories(Models.TextContent content, params Models.Category[] categories)
        {
            var bucket = content.GetRepository().GetClient();

            categories.ForEach((it, index) =>
            {
                bucket.ExecuteRemove(it.GetDocumentKey(), PersistTo.One);
            });
        }
开发者ID:Godoy,项目名称:CMS,代码行数:9,代码来源:TextContentProvider.cs

示例9: AddCategories

        public void AddCategories(Models.TextContent content, params Models.Category[] categories)
        {
            //((IPersistable)content).OnSaving();
            if (categories != null && categories.Length > 0)
            {
                MongoCollection<BsonDocument> collection = content.GetRepository().GetCategoriesCollection();
                collection.InsertBatch(categories.Select(it => it.ToBsonDocument()).ToArray());
            }

            //((IPersistable)content).OnSaved();
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:11,代码来源:TextContentProvider.cs

示例10: DeleteCategories

 public void DeleteCategories(Models.TextContent content, params Models.Category[] categories)
 {
     //((IPersistable)content).OnSaving();
     if (categories != null && categories.Length > 0)
     {
         MongoCollection<BsonDocument> collection = content.GetRepository().GetCategoriesCollection();
         var query = MongoDBQuery.Query.Or(categories.Select(it => new QueryComplete(it.ToBsonDocument())).ToArray());
         collection.Remove(query);
     }
     //((IPersistable)content).OnSaved();
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:11,代码来源:TextContentProvider.cs

示例11: Add

        public void Add(Models.TextContent content)
        {
            content.Remove("_id");

            content.StoreFiles();

            ((IPersistable)content).OnSaving();
            var database = content.GetRepository().GetDatabase();
            MongoCollection<BsonDocument> collection = database.GetCollection(content.GetSchema().GetSchemaCollectionName());
            collection.Insert(content.ToBsonDocument());
            ((IPersistable)content).OnSaved();
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:12,代码来源:TextContentProvider.cs

示例12: AddCategories

        public void AddCategories(Models.TextContent content, params Models.Category[] categories)
        {
            if (categories != null && categories.Length > 0)
            {
                var bucket = content.GetRepository().GetClient();

                categories.ForEach((it, index) =>
                {
                    bucket.ExecuteStore(StoreMode.Set, it.GetDocumentKey(), it.ToJson(), PersistTo.One);
                });
            }
        }
开发者ID:Godoy,项目名称:CMS,代码行数:12,代码来源:TextContentProvider.cs

示例13: Update

        public void Update(Models.TextContent @new, Models.TextContent old)
        {
            @new.StoreFiles();

            ((IPersistable)@new).OnSaving();
            var command = dbCommands.Update(@new);
            if (SQLCeTransactionUnit.Current != null)
            {
                SQLCeTransactionUnit.Current.RegisterCommand(command);
                SQLCeTransactionUnit.Current.RegisterPostAction(delegate() { ((IPersistable)@new).OnSaved(); });
            }
            else
            {
                SQLCeHelper.ExecuteNonQuery(@new.GetRepository().GetConnectionString(), command);
                ((IPersistable)@new).OnSaved();
            }
        }
开发者ID:jason1234,项目名称:CMS,代码行数:17,代码来源:TextContentProvider.cs

示例14: Delete

 public void Delete(Models.TextContent content)
 {
     var command = dbCommands.Delete(content);
     if (SQLCeTransactionUnit.Current != null)
     {
         SQLCeTransactionUnit.Current.RegisterCommand(command);
         SQLCeTransactionUnit.Current.RegisterPostAction(delegate() { TextContentFileHelper.DeleteFiles(content); });
     }
     else
     {
         SQLCeHelper.ExecuteNonQuery(content.GetRepository().GetConnectionString(), command);
         TextContentFileHelper.DeleteFiles(content);
     }
 }
开发者ID:jason1234,项目名称:CMS,代码行数:14,代码来源:TextContentProvider.cs

示例15: DeleteCategories

 public void DeleteCategories(Models.TextContent content, params Models.Category[] categories)
 {
     SQLCeHelper.ExecuteNonQuery(content.GetRepository().GetConnectionString(),
          categories.Select(it => dbCommands.DeleteCategory(content.GetRepository(), it)).ToArray());
 }
开发者ID:jason1234,项目名称:CMS,代码行数:5,代码来源:TextContentProvider.cs


注:本文中的Models.GetRepository方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。