یک نکتهی تکمیلی
به همراه NET Core 2.1.، یک HttpClientFactory توکار توسط مایکروسافت ارائه شدهاست:
به این ترتیب برای مثال جهت کار با یک آدرس مشخص، میتوان تنظیمات آنرا یکبار در آغاز برنامه ثبت کرد:
و بعد برای استفادهی سراسری از آن توسط سیستم ترزیق وابستگیها، میتوان به صورت زیر عمل کرد:
به همراه NET Core 2.1.، یک HttpClientFactory توکار توسط مایکروسافت ارائه شدهاست:
HttpClientFactory in ASP.NET Core 2.1 (Part 1) An Introduction to HttpClientFactory
HttpClientFactory in ASP.NET Core 2.1 (Part 2) Defining Named and Typed Clients
HttpClientFactory in ASP.NET Core 2.1 (Part 2) Defining Named and Typed Clients
به این ترتیب برای مثال جهت کار با یک آدرس مشخص، میتوان تنظیمات آنرا یکبار در آغاز برنامه ثبت کرد:
public void ConfigureServices(IServiceCollection services) { services.AddHttpClient("github", c => { c.BaseAddress = new Uri("https://api.github.com/"); c.DefaultRequestHeaders.Add("User-Agent", "HttpClientFactory-Sample"); // Github requires a user-agent }); services.AddHttpClient(); }
IHttpClientFactory _httpClientFactory; public MyController(IHttpClientFactory httpClientFactory) { _httpClientFactory = httpClientFactory; } public IActionResult Index() { //This client doesn’t have any special configuration applied var defaultClient = _httpClientFactory.CreateClient(); //This client has the header and base address configured for the “github” client above. var gitHubClient = _httpClientFactory.CreateClient("github"); return View(); }
There is quite a bit of Entity Framework and NHibernate comparisons on
the web already but all of them cover mostly the technical side of the
question. In this post, I’ll compare these two technologies from
a Domain Driven Design perspective. I’ll step through several code
examples and show you how both of these ORMs let you deal with problems.
اشتراکها
کتابخانه ModalWindowEffects
A set of experimental modal window appearance effects with CSS transitions and animations. Demo
اشتراکها
راهی جهت دور زدن مشکل دسترسی به npm
نظرات مطالب
انتقال فایلهای دیتابیس اس کیوال سرور 2008
این عدم دسترسی ممکن است هنگام attach سبب بروز خطاهای زیر هم شود (جهت تکمیل بحث):
- Database cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery
- CREATE FILE encountered operating system error 5 (failed to retrieve text for this error. Reason: 1815) while attempting to open or create the physical file
- Database cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery
- CREATE FILE encountered operating system error 5 (failed to retrieve text for this error. Reason: 1815) while attempting to open or create the physical file
اشتراکها
نوشتن اپ های Native برای موبایل
In the February 2016 issue of MSDN Magazine, I showed how to create a custom scripting language based on the Split-And-Merge algorithm for parsing mathematical expressions in C# (msdn.com/magazine/mt632273). I called my language Customizable Scripting in C#, or CSCS. Recently, I published an E-book that provided more details about creating a custom language (bit.ly/2yijCod). Creating your own scripting language might not initially seem to be particularly useful, even though there are some interesting applications of it (for example, game cheating). I also found some applications in Unity programming.