src/ZKEACMS/Zone/ZoneService.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/* http://www.zkea.net/
* Copyright (c) ZKEASOFT. All rights reserved.
* http://www.zkea.net/licenses */
using System;
using System.Collections.Generic;
using System.Linq;
using Easy.Extend;
using Easy.RepositoryPattern;
using ZKEACMS.Layout;
using ZKEACMS.Page;
using Easy;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Easy.Cache;
namespace ZKEACMS.Zone
{
public class ZoneService : ServiceBase<ZoneEntity, CMSDbContext>, IZoneService
{
private readonly IServiceProvider _serviceProvder;
private readonly ICacheManager<IEnumerable<ZoneEntity>> _cacheManager;
public ZoneService(IApplicationContext applicationContext, IServiceProvider serviceProvder, ICacheManager<IEnumerable<ZoneEntity>> cacheManager, CMSDbContext dbContext)
: base(applicationContext, dbContext)
{
_serviceProvder = serviceProvder;
_cacheManager = cacheManager;
}
public override DbSet<ZoneEntity> CurrentDbSet => DbContext.Zone;
public override IQueryable<ZoneEntity> Get()
{
return CurrentDbSet.AsNoTracking();
}
public override ServiceResult<ZoneEntity> Add(ZoneEntity item)
{
item.ID = Guid.NewGuid().ToString("N");
if (item.HeadingCode.IsNullOrEmpty())
{
item.HeadingCode = item.ID;
}
return base.Add(item);
}
public IEnumerable<ZoneEntity> GetByPage(PageEntity page)
{
IEnumerable<ZoneEntity> get(string key, string region)
{
IEnumerable<ZoneEntity> zones = Get().Where(m => m.PageId == page.ID).OrderBy(m => m.ID).ToList();
if (!zones.Any())
{
zones = GetByLayoutId(page.LayoutId);
if (ApplicationContext.IsAuthenticated)
{
foreach (var item in zones)
{
item.PageId = page.ID;
Add(item);
}
后面还有 26 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。