Skip to content

Commit

Permalink
Refactor ConfigService;
Browse files Browse the repository at this point in the history
  • Loading branch information
kklldog committed Jan 3, 2024
1 parent e37858c commit 4a6d8ee
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 74 deletions.
9 changes: 7 additions & 2 deletions src/AgileConfig.Server.Data.Freesql/FreesqlRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using FreeSql;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

Expand All @@ -12,8 +11,14 @@ namespace AgileConfig.Server.Data.Freesql
public class FreesqlRepository<T, T1> : IRepository<T, T1> where T : class, IEntity<T1>
{
private readonly IBaseRepository<T> _repository;

private readonly IFreeSqlFactory _freeSqlFactory;

protected IFreeSqlFactory FreeSqlFactory => _freeSqlFactory;

public FreesqlRepository(IFreeSqlFactory freeFactory)
{
_freeSqlFactory = freeFactory;
_repository = freeFactory.Create().GetRepository<T>();
}

Expand Down Expand Up @@ -86,7 +91,7 @@ private Expression<Func<T, object>> Sort(string defaultSortField)
}
var parameter = Expression.Parameter(typeof(T), "__q");
var memberExpress = Expression.Property(parameter, property);
return Expression.Lambda<Func<T,object>>(memberExpress, parameter);
return Expression.Lambda<Func<T, object>>(memberExpress, parameter);
}
return defaultSort;
}
Expand Down
3 changes: 3 additions & 0 deletions src/AgileConfig.Server.IService/IServiceInfoService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AgileConfig.Server.Data.Entity;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace AgileConfig.Server.IService
Expand All @@ -23,6 +24,8 @@ public interface IServiceInfoService: IDisposable

Task<string> ServicesMD5Cache();

Task<List<ServiceInfo>> QueryAsync(Expression<Func<ServiceInfo, bool>> exp);

void ClearCache();
}
}
Loading

0 comments on commit 4a6d8ee

Please sign in to comment.