<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension=".cs" #>
<#
		     string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");//获取解决方案路径
                string dirPath= Path.Combine(solutionsPath,@"Yi.Framework.Model\Models\");
                DirectoryInfo dir = new DirectoryInfo(dirPath);
                FileInfo[] finfo = dir.GetFiles();
                string filenames = string.Empty;
                List<string> filenameList = new List<string>();
                for (int i = 0; i < finfo.Length; i++)
                {
                    filenames = finfo[i].Name ; 
                    string[] fname=filenames.Split('.');
                    filenameList.Add(fname[0]);                  
                }  

                 
#>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Model.Models;
using Yi.Framework.Interface;
using Microsoft.EntityFrameworkCore;
using Yi.Framework.Model.ModelFactory;

namespace Yi.Framework.Service
{
   <#    foreach(string k in filenameList){ 
            string fn= k.Substring(0,1).ToUpper()+k.Substring(1);
 #>
        
        public partial class <#= fn #>Service:BaseService<<#= k #>>,I<#= fn #>Service 
        {
            public <#= fn #>Service(IDbContextFactory DbFactory):base(DbFactory){ }

            public async Task<bool> DelListByUpdateAsync(List<int> _ids)
            {
                var <#= k #>List = await GetEntitiesAsync(u=>_ids.Contains(u.id));
                <#= k #>List.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
                return await UpdateListAsync(<#= k #>List);
            }

            public async Task<IEnumerable<<#= k #>>> GetAllEntitiesTrueAsync()
            {
                return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
            }

        }
<#    } #>
}
