主頁 > .NET開發 > EF--封裝三層架構IOC

EF--封裝三層架構IOC

2020-09-10 09:39:36 .NET開發

  • 為什么分層?

不分層封裝的話,下面的代碼就是上端直接依賴于下端,也就是UI層直接依賴于資料訪問層,分層一定要依賴抽象,滿足依賴倒置原則,所以我們要封裝,要分層

下面這張圖和傳統的三層略有不同,不同之處在于,UI層不直接依賴于業務邏輯層,而是UI層依賴于業務邏輯抽象層IBLL,業務邏輯層不直接依賴于資料訪問層,而是業務邏輯層依賴于資料訪問抽象層IDAL

{
    SchoolDBEntities dbContext = new SchoolDBEntities();
    dbContext.Set<Student>().Where(s=>s.Student_ID == "0000000001");
}

  • 封裝分層

1、David.General.EF.Bussiness.Interface(IBLL--業務邏輯抽象層)

繼承IDisposable的目的是為了可以使用using,是為了釋放Context

IBaseService相當于上圖的IBLL(業務邏輯抽象層),DAL已經不存在了,因為EF已經取代了DAL層

namespace David.General.EF.Bussiness.Interface
{
    public interface IBaseService : IDisposable//可以使用using,是為了釋放Context
    {
        #region Query
        /// <summary>
        /// 根據id主鍵查詢物體
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        T Find<T>(object id) where T : class;

        /// <summary>
        /// 提供對單表的查詢
        /// 不推薦對外直接開放
        ///IQueryable支持運算式目錄樹
        /// </summary>
        /// <returns>IQueryable型別集合</returns>
        [Obsolete("盡量避免使用,using 帶運算式目錄樹的 代替")]
        IQueryable<T> Set<T>() where T : class;

        /// <summary>
        /// 查詢,傳入運算式目錄樹
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="funcWhere">運算式目錄樹</param>
        /// <returns>IQueryable型別集合</returns>
        IQueryable<T> Query<T>(Expression<Func<T, bool>> funcWhere) where T : class;

        /// <summary>
        /// 分頁查詢
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="S"></typeparam>
        /// <param name="funcWhere"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="funcOrderby"></param>
        /// <param name="isAsc"></param>
        /// <returns></returns>
        PageResult<T> QueryPage<T, S>(Expression<Func<T, bool>> funcWhere, int pageSize, int pageIndex, Expression<Func<T, S>> funcOrderby, bool isAsc = true) where T : class;
        #endregion

        #region Add
        /// <summary>
        /// 新增資料
        /// </summary>
        /// <param name="t"></param>
        /// <returns>回傳帶主鍵的物體</returns>
        T Insert<T>(T t) where T : class;

        /// <summary>
        /// 新增資料
        /// 多條sql 一個連接,事務插入
        /// </summary>
        /// <param name="tList"></param>
        IEnumerable<T> Insert<T>(IEnumerable<T> tList) where T : class;
        #endregion

        #region Update
        /// <summary>
        /// 更新資料
        /// </summary>
        /// <param name="t"></param>
        void Update<T>(T t) where T : class;

        /// <summary>
        /// 更新資料
        /// </summary>
        /// <param name="tList"></param>
        void Update<T>(IEnumerable<T> tList) where T : class;
        #endregion

        #region Delete
        /// <summary>
        /// 根據主鍵洗掉資料
        /// </summary>
        /// <param name="t"></param>
        void Delete<T>(int Id) where T : class;

        /// <su+mary>
        /// 洗掉資料
        /// </summary>
        /// <param name="t"></param>
        void Delete<T>(T t) where T : class;

        /// <summary>
        /// 洗掉資料
        /// </summary>
        /// <param name="tList"></param>
        void Delete<T>(IEnumerable<T> tList) where T : class;
        #endregion

        #region Other
        /// <summary>
        /// 立即保存全部修改
        /// 把增/刪的savechange給放到這里,是為了保證事務的
        /// </summary>
        void Commit();

        /// <summary>
        /// 執行sql 回傳集合
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        IQueryable<T> ExcuteQuery<T>(string sql, SqlParameter[] parameters) where T : class;

        /// <summary>
        /// 執行sql,無回傳
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        void Excute<T>(string sql, SqlParameter[] parameters) where T : class;
        #endregion
    }
}

public class PageResult<T>
{
    public int TotalCount { get; set; }
    public int PageIndex { get; set; }
    public int PageSize { get; set; }
    public List<T> DataList { get; set; }
}

2、David.General.EF.Bussiness.Service(業務邏輯實作層)

namespace David.General.EF.Bussiness.Service
{
    public class BaseService : IBaseService
    {
        #region Identity
        /// <summary>
        /// protected--保證只有子類可以看得見
        /// { get; private set; }--保證只有子類可以獲取,子類不能修改,只有自己可以修改
        /// </summary>
        protected DbContext Context { get; private set; }
        
       /// <summary>
        /// 建構式注入
        /// 一個請求一個,不能全域一個,應該一個實體一個
        /// </summary>
        /// <param name="context"></param>
        public BaseService(DbContext context)
        {
            this.Context = context;
        }
        #endregion Identity

        #region Query
        /// <summary>
        /// 通過Id得到物體
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        public T Find<T>(object id) where T : class
        {
            return this.Context.Set<T>().Find(id);
        }

        /// <summary>
        /// 不應該暴露給上端使用者,盡量少用
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        [Obsolete("盡量避免使用,using 帶運算式目錄樹的代替")]
        public IQueryable<T> Set<T>() where T : class
        {
            return this.Context.Set<T>();
        }

        /// <summary>
        /// 這才是合理的做法,上端給條件,這里查詢
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="funcWhere"></param>
        /// <returns></returns>
        public IQueryable<T> Query<T>(Expression<Func<T, bool>> funcWhere) where T : class
        {
            return this.Context.Set<T>().Where<T>(funcWhere);
        }

        /// <summary>
        /// 分頁查詢
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="S"></typeparam>
        /// <param name="funcWhere">查詢條件運算式目錄樹</param>
        /// <param name="pageSize">頁大小</param>
        /// <param name="pageIndex">頁索引</param>
        /// <param name="funcOrderby">按什么欄位排序</param>
        /// <param name="isAsc">升序還是降序</param>
        /// <returns></returns>
        public PageResult<T> QueryPage<T, S>(Expression<Func<T, bool>> funcWhere, int pageSize, int pageIndex, Expression<Func<T, S>> funcOrderby, bool isAsc = true) where T : class
        {
            var list = this.Set<T>();
            if (funcWhere != null)
            {
                list = list.Where<T>(funcWhere);
            }
            if (isAsc)
            {
                list = list.OrderBy(funcOrderby);
            }
            else
            {
                list = list.OrderByDescending(funcOrderby);
            }
            PageResult<T> result = new PageResult<T>()
            {
                DataList = list.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(),
                PageIndex = pageIndex,
                PageSize = pageSize,
                TotalCount = this.Context.Set<T>().Count(funcWhere)
            };
            return result;
        }
        #endregion

        #region Insert
        /// <summary>
        /// 插入
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public T Insert<T>(T t) where T : class
        {
            this.Context.Set<T>().Add(t);
            return t;
        }

        /// <summary>
        /// 插入集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tList"></param>
        /// <returns></returns>
        public IEnumerable<T> Insert<T>(IEnumerable<T> tList) where T : class
        {
            this.Context.Set<T>().AddRange(tList);
            return tList;
        }
        #endregion

        #region Update
        /// <summary>
        /// 是沒有實作查詢,直接更新的,需要Attach和State
        /// 
        /// 如果是已經在context,只能再封裝一個(在具體的service)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        public void Update<T>(T t) where T : class
        {
            if (t == null) throw new Exception("t is null");

            this.Context.Set<T>().Attach(t);//將資料附加到背景關系,支持物體修改和新物體,重置為UnChanged
            this.Context.Entry<T>(t).State = EntityState.Modified;//全欄位更新
        }

        /// <summary>
        /// 集合修改
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tList"></param>
        public void Update<T>(IEnumerable<T> tList) where T : class
        {
            foreach (var t in tList)
            {
                this.Context.Set<T>().Attach(t);
                this.Context.Entry<T>(t).State = EntityState.Modified;
            }
        }
        
        /// <summary>
        /// 更新資料,指定更新哪些列,哪怕有些列值發生了變化,沒有指定列也不能修改
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        public void UpdateSpecifyFiled<T>(T t, List<string> filedList) where T : class
        {
            this.Context.Set<T>().Attach(t);//將資料附加到背景關系
            foreach(var filed in filedList)
            {
                this.Context.Entry<T>(t).Property(filed).IsModified = true;//指定某欄位被改過
            }
        }
        #endregion

        #region Delete
        /// <summary>
        /// 先附加 再洗掉
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        public void Delete<T>(T t) where T : class
        {
            if (t == null) throw new Exception("t is null");
            this.Context.Set<T>().Attach(t);
            this.Context.Set<T>().Remove(t);
        }

        /// <summary>
        /// 還可以增加非即時commit版本的,
        /// 做成protected
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="Id"></param>
        public void Delete<T>(int Id) where T : class
        {
            T t = this.Find<T>(Id);//也可以附加
            if (t == null) throw new Exception("t is null");
            this.Context.Set<T>().Remove(t);
        }

        /// <summary>
        /// 洗掉集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tList"></param>
        public void Delete<T>(IEnumerable<T> tList) where T : class
        {
            foreach (var t in tList)
            {
                this.Context.Set<T>().Attach(t);
            }
            this.Context.Set<T>().RemoveRange(tList);
        }
        #endregion

        #region Other
        /// <summary>
        /// 一次性提交
        /// </summary>
        public void Commit()
        {
            this.Context.SaveChanges();
        }

        /// <summary>
        /// sql陳述句查詢
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public IQueryable<T> ExcuteQuery<T>(string sql, SqlParameter[] parameters) where T : class
        {
            return this.Context.Database.SqlQuery<T>(sql, parameters).AsQueryable();
        }

        /// <summary>
        /// 執行sql陳述句
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        public void Excute<T>(string sql, SqlParameter[] parameters) where T : class
        {
            DbContextTransaction trans = null;
            try
            {
                trans = this.Context.Database.BeginTransaction();
                this.Context.Database.ExecuteSqlCommand(sql, parameters);
                trans.Commit();
            }
            catch (Exception ex)
            {
                if (trans != null)
                    trans.Rollback();
                throw ex;
            }
        }

        public virtual void Dispose()
        {
            if (this.Context != null)
            {
                this.Context.Dispose();
            }
        }
        #endregion
    }
}
  • 整合Unity,實作IOC,依賴注入解決問題

雖然封裝完了,但是還是帶來了2個問題,問題如下代碼所示,所以我們需要解決下面兩個問題
問題1:通過封裝,完成了通過Service來完成對資料庫的訪問,但是右邊 new StudentService()是細節,不滿足依賴倒置原則,應該面向抽象編程
問題2:構造new StudentService()的時候需要一個Context,不能每次都SchoolDBEntities dbContext = new SchoolDBEntities();

{
    SchoolDBEntities dbContext = new SchoolDBEntities();
    using (IStudentService iStudentService = new StudentService(dbContext))
    {
        Student student = iStudentService.Find<Student>("0000000001");

        Student student1 = new Student();
        student1.Student_ID = "1111111";
        student1.Student_Name = "Student1";
        iStudentService.Insert(student1);

        iStudentService.Commit();
    }
}

1、Nuget引入Unity相關dll

2、配置Unity.Config

.2.1、給BaseService注入DbContext

<register type="System.Data.Entity.DbContext, EntityFramework" mapTo="David.General.EF.Model.SchoolDBEntities,David.General.EF.Model"/>

type中逗號前是完整型別名稱,也就是命名空間System.Data.Entity+類名DbContext,逗號后是dll名稱EntityFramework

mapTo中逗號前是完整型別名稱,也就是命名空間David.General.EF.Model+類名SchoolDBEntities,逗號后是dll名稱David.General.EF.Model

2.2、給IStudentService注入StudentService

<register type="David.General.EF.Bussiness.Interface.IStudentService,David.General.EF.Bussiness.Interface" mapTo="David.General.EF.Bussiness.Service.StudentService, David.General.EF.Bussiness.Service">

type中逗號前是完整型別名稱,也就是命名空間David.General.EF.Bussiness.Interface+介面名IStudentService,逗號后是dll名稱David.General.EF.Bussiness.Interface

 

mapTo中逗號前是完整型別名稱,也就是命名空間David.General.EF.Bussiness.Service+類名StudentService,逗號后是dll名稱David.General.EF.Bussiness.Service

<configuration>
  <configSections>
    <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Unity.Configuration"/>
  </configSections>
  <unity>
    <sectionExtension type="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, Unity.Interception.Configuration"/>
    <containers>
      <container name="MyContainer">
        <extension type="Interception"/>
        <register type="System.Data.Entity.DbContext, EntityFramework" mapTo="David.General.EF.Model.SchoolDBEntities,David.General.EF.Model"/>
        <register type="David.General.EF.Bussiness.Interface.IStudentService,David.General.EF.Bussiness.Interface" mapTo="David.General.EF.Bussiness.Service.StudentService, David.General.EF.Bussiness.Service">
        </register>
      </container>
    </containers>
  </unity>
</configuration>

3、呼叫服務
如下呼叫代碼和截圖所示
首先:我們構建學生服務的時候,沒有出現細節StudentService
其次:在構建學生服務的時候,沒有顯式的去傳入DbContext,StudentService繼承BaseService,StudentService的建構式的引數DbContext是來源于BaseService,而BaseService依賴的DbContext是通過建構式注入進來的

 

{
  //UnityConfig配置只用初始化一次,所以我們把讀取UnityConfig配置封裝一下
  //使用單例模式,l利用靜態建構式只初始化1次的特點,達到配置只初始化1次
  Unity.IUnityContainer container = ContainerFactory.GetContainer();

  //IOC:去掉細節依賴,降低耦合,增強擴展性
  using (IStudentService iStudentService = container.Resolve<IStudentService>())
  {
    Student student = iStudentService.Find<Student>("0000000001");

    //測驗指定更新
    Student oldStudent = new Student()
    {
      Student_ID = "0000020001",
      Student_Name = "豬豬",
      Student_Sex
= ""     };     List<string> filedList = new List<string>();     filedList.Add("Student_Name");     iStudentService.UpdateSpecifyFiled<Student>(oldStudent, filedList);     iStudentService.Commit();   }
}

 

namespace David.General.EF.Bussiness.Service
{
    public class StudentService : BaseService,IStudentService
    {
        public StudentService(DbContext context) : base(context)
        {
        }

        /// <summary>
        /// 記錄學生打架
        /// </summary>
        /// <param name="student"></param>
        public void RecordStudentFight(Student student)
        {
            base.Insert(student);
            this.Commit();
        }
    }
}

 

 

轉載請註明出處,本文鏈接:https://www.uj5u.com/net/1666.html

標籤:Entity Framework

上一篇:EF--EntityState相互轉換

下一篇:ASP.NET MVC——CodeFirst開發模式

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • WebAPI簡介

    Web體系結構: 有三個核心:資源(resource),URL(統一資源識別符號)和表示 他們的關系是這樣的:一個資源由一個URL進行標識,HTTP客戶端使用URL定位資源,表示是從資源回傳資料,媒體型別是資源回傳的資料格式。 接下來我們說下HTTP. HTTP協議的系統是一種無狀態的方式,使用請求/ ......

    uj5u.com 2020-09-09 22:07:47 more
  • asp.net core 3.1 入口:Program.cs中的Main函式

    本文分析Program.cs 中Main()函式中代碼的運行順序分析asp.net core程式的啟動,重點不是剖析原始碼,而是理清程式開始時執行的順序。到呼叫了哪些實體,哪些法方。asp.net core 3.1 的程式入口在專案Program.cs檔案里,如下。ususing System; us ......

    uj5u.com 2020-09-09 22:07:49 more
  • asp.net網站作為websocket服務端的應用該如何寫

    最近被websocket的一個問題困擾了很久,有一個需求是在web網站中搭建websocket服務。客戶端通過網頁與服務器建立連接,然后服務器根據ip給客戶端網頁發送資訊。 其實,這個需求并不難,只是剛開始對websocket的內容不太了解。上網搜索了一下,有通過asp.net core 實作的、有 ......

    uj5u.com 2020-09-09 22:08:02 more
  • ASP.NET 開源匯入匯出庫Magicodes.IE Docker中使用

    Magicodes.IE在Docker中使用 更新歷史 2019.02.13 【Nuget】版本更新到2.0.2 【匯入】修復單列匯入的Bug,單元測驗“OneColumnImporter_Test”。問題見(https://github.com/dotnetcore/Magicodes.IE/is ......

    uj5u.com 2020-09-09 22:08:05 more
  • 在webform中使用ajax

    如果你用過Asp.net webform, 說明你也算是.NET 開發的老兵了。WEBform應該是2011 2013左右,當時還用visual studio 2005、 visual studio 2008。后來基本都用的是MVC。 如果是新開發的專案,估計沒人會用webform技術。但是有些舊版 ......

    uj5u.com 2020-09-09 22:08:50 more
  • iis添加asp.net網站,訪問提示:由于擴展配置問題而無法提供您請求的

    今天在iis服務器配置asp.net網站,遇到一個問題,記錄一下: 問題:由于擴展配置問題而無法提供您請求的頁面。如果該頁面是腳本,請添加處理程式。如果應下載檔案,請添加 MIME 映射。 WindowServer2012服務器,添加角色安裝完.netframework和iis之后,運行aspx頁面 ......

    uj5u.com 2020-09-09 22:10:00 more
  • WebAPI-處理架構

    帶著問題去思考,大家好! 問題1:HTTP請求和回傳相應的HTTP回應資訊之間發生了什么? 1:首先是最底層,托管層,位于WebAPI和底層HTTP堆疊之間 2:其次是 訊息處理程式管道層,這里比如日志和快取。OWIN的參考是將訊息處理程式管道的一些功能下移到堆疊下端的OWIN中間件了。 3:控制器處理 ......

    uj5u.com 2020-09-09 22:11:13 more
  • 微信門戶開發框架-使用指導說明書

    微信門戶應用管理系統,采用基于 MVC + Bootstrap + Ajax + Enterprise Library的技術路線,界面層采用Boostrap + Metronic組合的前端框架,資料訪問層支持Oracle、SQLServer、MySQL、PostgreSQL等資料庫。框架以MVC5,... ......

    uj5u.com 2020-09-09 22:15:18 more
  • WebAPI-HTTP編程模型

    帶著問題去思考,大家好!它是什么?它包含什么?它能干什么? 訊息 HTTP編程模型的核心就是訊息抽象,表示為:HttPRequestMessage,HttpResponseMessage.用于客戶端和服務端之間交換請求和回應訊息。 HttpMethod類包含了一組靜態屬性: private stat ......

    uj5u.com 2020-09-09 22:15:23 more
  • 部署WebApi隨筆

    一、跨域 NuGet參考Microsoft.AspNet.WebApi.Cors WebApiConfig.cs中配置: // Web API 配置和服務 config.EnableCors(new EnableCorsAttribute("*", "*", "*")); 二、清除默認回傳XML格式 ......

    uj5u.com 2020-09-09 22:15:48 more
最新发布
  • C#多執行緒學習(二) 如何操縱一個執行緒

    <a href="https://www.cnblogs.com/x-zhi/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/2943582/20220801082530.png" alt="" /></...

    uj5u.com 2023-04-19 09:17:20 more
  • C#多執行緒學習(二) 如何操縱一個執行緒

    C#多執行緒學習(二) 如何操縱一個執行緒 執行緒學習第一篇:C#多執行緒學習(一) 多執行緒的相關概念 下面我們就動手來創建一個執行緒,使用Thread類創建執行緒時,只需提供執行緒入口即可。(執行緒入口使程式知道該讓這個執行緒干什么事) 在C#中,執行緒入口是通過ThreadStart代理(delegate)來提供的 ......

    uj5u.com 2023-04-19 09:16:49 more
  • 記一次 .NET某醫療器械清洗系統 卡死分析

    <a href="https://www.cnblogs.com/huangxincheng/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/214741/20200614104537.png" alt="" /&g...

    uj5u.com 2023-04-18 08:39:04 more
  • 記一次 .NET某醫療器械清洗系統 卡死分析

    一:背景 1. 講故事 前段時間協助訓練營里的一位朋友分析了一個程式卡死的問題,回過頭來看這個案例比較經典,這篇稍微整理一下供后來者少踩坑吧。 二:WinDbg 分析 1. 為什么會卡死 因為是表單程式,理所當然就是看主執行緒此時正在做什么? 可以用 ~0s ; k 看一下便知。 0:000> k # ......

    uj5u.com 2023-04-18 08:33:10 more
  • SignalR, No Connection with that ID,IIS

    <a href="https://www.cnblogs.com/smartstar/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/u36196.jpg" alt="" /></a>...

    uj5u.com 2023-03-30 17:21:52 more
  • 一次對pool的誤用導致的.net頻繁gc的診斷分析

    <a href="https://www.cnblogs.com/dotnet-diagnostic/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/3115652/20230225090434.png" alt=""...

    uj5u.com 2023-03-28 10:15:33 more
  • 一次對pool的誤用導致的.net頻繁gc的診斷分析

    <a href="https://www.cnblogs.com/dotnet-diagnostic/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/3115652/20230225090434.png" alt=""...

    uj5u.com 2023-03-28 10:13:31 more
  • C#遍歷指定檔案夾中所有檔案的3種方法

    <a href="https://www.cnblogs.com/xbhp/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/957602/20230310105611.png" alt="" /></a&...

    uj5u.com 2023-03-27 14:46:55 more
  • C#/VB.NET:如何將PDF轉為PDF/A

    <a href="https://www.cnblogs.com/Carina-baby/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/2859233/20220427162558.png" alt="" />...

    uj5u.com 2023-03-27 14:46:35 more
  • 武裝你的WEBAPI-OData聚合查詢

    <a href="https://www.cnblogs.com/podolski/" target="_blank"><img width="48" height="48" class="pfs" src="https://pic.cnblogs.com/face/616093/20140323000327.png" alt="" /><...

    uj5u.com 2023-03-27 14:46:16 more