12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using System;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- using System.Text;
- using System.Threading.Tasks;
- namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
- {
- /// <summary>
- /// "$.name":"明",
- /// "!$.name":"小"
- /// "code.|":{"aaa"}
- /// "<.birthday":20150101,
- /// "!=.type":"测试",
- /// "<=.day":"1515"
- /// ">.age.&":18,
- /// "codes[*]":{"aaa"}
- /// "codes[*]":["aaa","bbb"]
- /// "code":["aaa","bbb"]
- /// "@OFFSET":1,
- /// "@LIMIT":10,
- /// "@DESC","crateTime"
- /// "@ASC","crateTime"
- /// </summary>
- public interface IAzureCosmosDBV3Repository
- {
- Task<T> Save<T>(T entity) where T : ID;
- Task<List<T>> SaveAll<T>(List<T> enyites) where T : ID;
- Task<IdPk> DeleteAsync<T>(T entity) where T : ID;
- Task<IdPk> DeleteAsync<T>(string id, string pk) where T : ID;
- Task<IdPk> DeleteAsync<T>(IdPk idPk) where T : ID;
- Task<List<IdPk>> DeleteAll<T>(List<T> entities) where T : ID;
- Task<List<IdPk>> DeleteAll<T>(List<IdPk> ids) where T : ID;
- Task<List<IdPk>> DeleteAll<T>(Dictionary<string, object> dict) where T : ID;
- Task<T> Update<T>(T entity) where T : ID;
- Task<List<T>> UpdateAll<T>(List<T> entities) where T : ID;
- Task<T> SaveOrUpdate<T>(T entity) where T : ID;
- Task<List<T>> SaveOrUpdateAll<T>(List<T> entities) where T : ID;
- // Task<T> FindById<T>(string id) where T : ID;
- Task<T> FindByIdPk<T>(string id, string pk) where T : ID;
- // Task<string> ReplaceObject<T>(T entity, string key, string partitionKey) where T : ID;
- Task<List<T>> FindAll<T>(List<string> propertys = null) where T : ID;
- /// <summary>
- /// QueryText = @"SELECT *
- // FROM c
- // WHERE c.documentType = @documentType
- // AND c.id = @id",
- //Parameters = new[]
- //{
- // new CosmosDbQueryParameter("@documentType", GetDocumentType<T>()),
- // new CosmosDbQueryParameter("@id", id)
- //}
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="sql"></param>
- /// <param name="Parameters"></param>
- /// <returns></returns>
- Task<List<T>> FindSQL<T>(string sql, Dictionary<string, object> Parameters = null, int itemsPerPage = -1, int? maxItemCount = null) where T : ID;
- //Task<List<T>> FindSQL<T>(string sql, bool isPK) where T : ID;
- /// <summary>
- /////正确的代码
- //Expression<Func<QuestionFeed, bool>> predicate = null;
- // query = f => 1==1;
- // query= query.And(x =>x.Address.City== "Seattle3");
- // query= query.Or(x => x.id== "Andersen.1");
- // query = query.And(x => x.Parents.Where(y => y.FirstName == "Thomas1").Any()) ;
- // Expression<Func<Family, object>> order = null;
- //order = f => f.id;
- //_questionFeedRepository.Entities.Where(predicate);
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="itemsPerPage"></param>
- /// <param name="query"></param>
- /// <returns></returns>
- Task<List<T>> FindLinq<T>(Expression<Func<T, bool>> query = null, Expression<Func<T, object>> order = null, bool isDesc = false, int itemsPerPage = -1, int? maxItemCount = null) where T : ID;
- Task<List<T>> FindByParams<T>(Dictionary<string, object> dict, int itemsPerPage = -1, int? maxItemCount = null, string partitionKey = null, List<string> propertys = null) where T : ID;
- Task<List<T>> FindByDict<T>(Dictionary<string, object> dict, int itemsPerPage = -1, int? maxItemCount = null, string partitionKey = null, List<string> propertys = null) where T : ID;
- Task<List<dynamic>> FindByDict(string CollectionName, Dictionary<string, object> dict, int itemsPerPage = -1, int? maxItemCount = null, string partitionKey = null, List<string> propertys = null);
- Task<List<dynamic>> FindCountByDict(string CollectionName, Dictionary<string, object> dict, int itemsPerPage = -1, int? maxItemCount = null, string partitionKey = null);
- Task InitializeDatabase();
- Task<T>FindById<T>(string id) where T : ID;
- Task<List<T>> FindByIds<T>(List<string> ids) where T : ID;
- Task<dynamic> FindById(string CollectionName, string id);
- Task<List<dynamic>> FindByIds (string CollectionName, List<string> ids);
- }
- }
|