C# 7 is a major update with a lot of interesting new capabilities. And while there are plenty of articles on what you can do with it, there aren't quite as many on what you should do with it. Using the principles found in the .NET Framework Design Guidelines, we're going to take a first pass at laying down strategies for getting the most from these new features.
حالا چطور و چگونه ازش استفاده کنیم؟!
این Extension کارش این است، وقتی HttpClient ما مقدار دهی شده و آمادهی برای ارسال درخواست به سرویس بیرونی است، میتوانیم قبل ارسال، آن را فراخوانی کنیم و یک خروجی Curl از درخواستی را که داریم میفرستیم، ببینیم. سپس خروجی Curl را در ترمینال صدا بزنیم و نتیجه را ببینیم. همینطور میتوانیم به Postman خود Import کنیم و با داکیومنتی که داده شده، بررسی کنیم و مشکل را دقیقتر بررسی کنیم.
نحوه Import کردن Curl در Postman
open the Postman -> click on the Import button -> select the Raw text tab -> paste the curl script here -> then press the Continue button -> at the end press the button import.
استفاده از این Extension بسیار ساده و سریع است و شما با نوشتن یک خط میتوانید آن را فراخوانی کنید:
این Extension سه(۳) راه برای نمایش Curl دارد:
۱- چاپ در Console
httpClient.GenerateCurlInConsole(httpRequestMessage, null);
httpClient.GenerateCurlInConsole( httpRequestMessage, configs => { configs.TurnOn = true; configs.NeedAddDefaultHeaders = true; configs.EnableCodeBeautification = false; });
- با مقدارNeedAddDefaultHeaders میتوانید مشخص کنید در صورت داشتن هدرهای پیش فرض، در خروجی Curl اضافه شود یا خیر. پیش فرض آن فعال هست.
- مقدارEnableCodeBeautification اگر فعال باشد اسکریپتهای چاپ شده در Console را به ازای هر HttpMethod، با رنگ متفاوتی نشان میدهد؛ برای خوانایی بهتر اسکریپت. بصورت پیش فرض غیر فعال است.
۲- ذخیره در فایل
httpClient.GenerateCurlInFile(httpRequestMessage, null);
مثال و توضیحات کانفیگ به شرح زیر است:
httpClient.GenerateCurlInFile( httpRequestMessage, configs => { configs.Filename = "your filename"; configs.Path = "your path"; configs.TurnOn = true; configs.NeedAddDefaultHeaders = true; });
- مقدارPath را میتوانید در صورت داشتن مسیری خاص، مشخص کنید. در غیر این صورت بصورت پیش فرض اطلاعات را در مسیر ProjectDirectory\bin\Debug\netX ذخیره میکند.
- مقدارTurnOn پیش فرض آن فعال است. درصورت غیرفعال کردن جنریتور غیر فعال میشود و عمل ایجاد اسکریپت را انجام نمیدهد.
- با مقدار NeedAddDefaultHeaders میتوانید مشخص کنید در صورت داشتن هدرهای پیش فرض، در خروجی Curl اضافه شود یا خیر. پیش فرض آن فعال هست.
۳- ذخیره در متغیر
httpClient.GenerateCurlInString(httpRequestMessage);
لینک آدرس GitHub پروژه جهت دیدن سورس پروژه و دیدن مثالهای بیشتر و همینطور برای دیدن قابلیتهای بیشتر این extension.
خوشحال میشوم اگه نظری دارید راجع به پروژه و یا مشکلی دیدید در سورس کد به من اطلاع بدهید و خیلی خوشحال میشوم اگر در تکمیل و پیاده سازی این پروژه مشارکت کنید و اگر این پروژه براتون جذاب و یا مفید بود استار بدهید.
SDK چیست ؟
بررسی نکات مخفی در NET Core 3.
You've likely heard about the headline features in .NET Core 3.0 including Blazor, gRPC, and Windows desktop app support, but what else is there? This is a big release so come and see David Fowler and Damian Edwards from the .NET Core team showcase their favorite new features you probably haven't heard about in this demo-packed session.
سورس نگارش کامل دات نت
The referencesource repository contains sources from Microsoft .NET Reference Source that represent a subset of the .NET Framework. This subset contains similar functionality to the class libraries that are being developed in .NET Core. We intend to consult the referencesource repository as we develop .NET Core. It is also for the community to leverage to enable more scenarios for .NET developers.
ReScript زبان پس از TypeScript؟
In the confusing jungle of transpiler languages for JavaScript, there are some gems. TypeScript is mainstream, ReScript is starting to establish itself, and Elm is still an insider tip. This article takes a detailed look at ReScript – but also sheds light on the limitations of the young language. In what projects does its use make sense? What projects should rather use TypeScript on the one hand or Elm on the other?
The "Blazor United" effort is really a collection of features we're adding to Blazor so that you can get the best of server & client based web development. These features include: Server-side rendering, streaming rendering, enhanced navigations & form handling, add client interactivity per page or component, and determining the client render mode at runtime. We've started delivering server-side rendering support for Blazor with .NET 8 Preview 3, which is now available to try out. We plan to deliver the remaining features in upcoming previews. We hope to deliver them all for .NET 8, but we'll see how far we get.
سالهاست که از کامپوننتهای DevComponents در کارهای خودم استفاده میکنم. شاید شما هم از طرفداران این کامپوننتها باشید چرا که در بین شرکتهای موجود، ارائه کیفیت در عین حفظ کمترین تعداد dllها از ویژگیهای بارز DevComponents محسوب میشود.
در حالیکه برای بررسی نخسههای آخر سری به وبسایت و بعد وبلاگشون زدم، متوجه شدم که DevComponents علاقمند به همکاری با برنامهنویسان و طراحان از سرتاسر دنیاست. متن آغازین این همکاری برام خیلی جالب بود:
"There are three kinds of people in this world: Those who make things happen; those who watch things happen; and those who just wonder what a heck happened? "
خلاصه اگر به دسته اول تعلق دارید، میتوانید از این فرصت بهرهمند شوید. تنها چیزی که به آن احتیاج دارید بستر اینترنت خوب برای برقراری ارتباط میباشد.
You can be located anywhere in the world as long as you have internet connection. You can work any hours you want as long as work gets done. You have freedom and control over your working hours. All we ask for is that things get done. You will also get responsibility of supporting whatever you develop since we believe that is the best way to understand what our customers need.
alert()/confirm()/prompt() dialogs are being changed. Rather than being app-modal, they will be dismissed when their tab is switched from. (Safari 9.1 already does this.) This is fully enabled on the canary and dev channels and partially enabled on the beta and stable channels, and will be enabled more in the future.