خلاصه اشتراکهای روز دو شنبه 21 آذر 1390
در این لینک هم
http://forums.silverlight.net/t/244120.aspx/2/10?When+will+Microsoft+announce+this+as+the+final+version+
Pete Brown مطالبی رو عنوان میکنه که قابل توجه هستش
روش فعالسازی Windows Sandbox
پیاده سازی سرویس دیسکاوری با Consul
بعد از مدتها دوری از این پلی لیست، گفتیم یکمی این رو هم ببریم جلو و یه ویدیو براش بسازیم در ادامه بحث مایکروسرویس ها، این سری رفتیم سراغ سرویس دیسکاوری و با Consul که از کمپانی HashiCorp هست، کار کردیم و تونستیم مایکروسرویس هارو در زمان لود رجیستر کنیم و Ocelot رو هم به این سرویس دیسکاوری وصل کنیم.
00:00 Ocelot, API Gateway
05:00 Implementing 2 Microservices and API Gateway
10:08 What is Consul
10:37 Running Consul in Docker
15:31 Consul UI
16:40 Self Registration Microservice into Consul
20:28 IHostedService
27:15 Register Services into IServiceCollection
35:00 Connect Ocelot to Consul
مدت زمان ویدیو : 41 دقیقه
مقدمه ای بر برنامه نویسی همزمان
What is concurrent programing? Simply described, it’s when you are doing more than one thing at the same time. Not to be confused with parallelism, concurrency is when multiple sequences of operations are run in overlapping periods of time. In the realm of programming, concurrency is a pretty complex subject. Dealing with constructs such as threads and locks and avoiding issues like race conditions and deadlocks can be quite cumbersome, making concurrent programs difficult to write. Through concurrency, programs can be designed as independent processes working together in a specific composition. Such a structure may or may not be made parallel; however, achieving such a structure in your program offers numerous advantages.
لیست جلسات Microsoft Build 2020
namespace ProductService.Models { public class ProductRating { public int ID { get; set; } public int Rating { get; set; } public int ProductID { get; set; } public virtual Product Product { get; set; } } }
ODataModelBuilder builder = new ODataConventionModelBuilder(); builder.EntitySet<Product>("Products"); builder.Namespace = "ProductService"; builder.EntityType<Product>() .Action("Rate") .Parameter<int>("Rating");
[HttpPost] public async Task<IHttpActionResult> Rate([FromODataUri] int key, ODataActionParameters parameters) { if (!ModelState.IsValid) { return BadRequest(); } int rating = (int)parameters["Rating"]; db.Ratings.Add(new ProductRating { ProductID = key, Rating = rating }); await db.SaveChangesAsync(); return StatusCode(HttpStatusCode.NoContent); }
POST http://localhost/Products(1)/ProductService.Rate HTTP/1.1 Content-Type: application/json Content-Length: 12 {"Rating":5}
HttpClient client = new HttpClient(); var response = client.PostAsync(postUrl, new StringContent(JsonConvert.SerializeObject(new { Rating = 5 }), Encoding.UTF8, "application/json")).Result;
اضافه کردن متد Function
ODataModelBuilder builder = new ODataConventionModelBuilder(); builder.EntitySet<Product>("Products"); builder.EntitySet<Supplier>("Suppliers"); builder.Namespace = "ProductService"; builder.EntityType<Product>().Collection .Function("MostExpensive") .Returns<double>();
نکته:
ReturnsFromEntitySet<Product>("Products")
ReturnsCollectionFromEntitySet<Product>("Products");
ReturnsCollection<string>();
برای فراخوانی این متد میتوان از آدرس زیر استفاده نمود:
GET http://localhost/Products/ProductService.MostExpensive
حال فقط کافیست که متد آن را در کنترلر مربوطه پیاده سازی نماییم:
public class ProductsController : ODataController { [HttpGet] public IHttpActionResult MostExpensive() { var product = db.Products.Max(x => x.Price); return Ok(product); } // Other controller methods not shown. }
HTTP/1.1 200 OK Content-Type: application/json; odata.metadata=minimal; odata.streaming=true OData-Version: 4.0 Date: Sat, 28 Jun 2016 00:44:07 GMT Content-Length: 85 { "@odata.context":"http://localhost:38479/$metadata#Edm.Decimal","value":50.00 }
اضافه کردن Unbound Function
ODataModelBuilder builder = new ODataConventionModelBuilder(); builder.EntitySet<Product>("Products"); builder.Function("GetSalesTaxRate") .Returns<double>() .Parameter<int>("PostalCode");
[HttpGet] [ODataRoute("GetSalesTaxRate(PostalCode={postalCode})")] public IHttpActionResult GetSalesTaxRate([FromODataUri] int postalCode) { double rate = 5.6; // Use a fake number for the sample. return Ok(rate); }
برای فراخوانی آن نیز از درخواست زیر استفاده مینماییم:
GET http://localhost/GetSalesTaxRate(PostalCode=10) HTTP/1.1
HTTP/1.1 200 OK Content-Type: application/json; odata.metadata=minimal; odata.streaming=true OData-Version: 4.0 Date: Sat, 28 Jun 2016 01:05:32 GMT Content-Length: 82 { "@odata.context":"http://localhost:38479/$metadata#Edm.Double","value":5.6 }
شاید سؤالی برایتان پیش بیاید که آیا برای تعریف هر متد، این همه مراحل کانفیگ لازم است؟! در واقع باید عرض کنم، این نوع استفاده از OData، ابتداییترین نوع طراحی آن میباشد و قطعا در یک برنامهی واقعی این همه کد نویسی برای نوشتن فقط یک متد، شاید منطقی به نظر نمیرسد. از آنجاییکه این مقاله فقط جنبهی آموزشی خیلی ساده از این پروتکل را دارد، فعلا به همین اندازه بسنده میکنیم. اما در مقالههای بعدی راهحلهایی برای بینهایت ساده کردن کانفیگ OData را شرح خواهیم داد.
This webcast is a code-focused introduction to developing workflow-enabled Microsoft Windows platform applications. We cover the basics of developing, designing, and debugging workflow solutions. Gain the knowledge and insight you need to be confident choosing workflow for everyday applications.
Intro to Windows Workflow Foundation (Part 2 of 7): Simple Human Workflow Using E-mail (Level 200)
Have you thought about how you might apply the workflow concept to e-mail? In this webcast New Zealand based regional director, Chris Auld, leads attendees through a simple worked example of the use of SMTP e-mail as part of a workflow solution. Chris demonstrates how to create custom activities to query Active Directory to retrieve user data, send e-mail, and wait for e-mail responses to continue the workflow process. This code-intensive session gives users taking their first steps with workflow a good grounding in some of the key extensibility concepts.
Intro to Windows Workflow Foundation (Part 3 of 7): Hosting and Communications Options in Workflow Scenarios (Level 300)
The session looks at options for hosting workflow applications. We cover managing events, instance tracking, and persistence, and provide a close look at the simple communications mechanisms that are available for you to use in your workflow applications.
Intro to Windows Workflow Foundation (Part 4 of 7): Workflow, Messaging, and Services: Developing Distributed Applications with Workflows (Level 300)
Web service technologies have typically taken a "do-it-yourself" approach to maintaining the interoperation state of services. Using workflow, developers now have tools that allow them to describe the long-running state of their services and delegate much of the state management to the underlying platform. Managing this state correctly becomes even more challenging in applications that coordinate work across multiple services either within an organization or at an Internet scale. This session looks at how developers who use either Microsoft ASMX or Microsoft's framework for building service-oriented applications, code-named "Indigo", can create workflow-oriented applications that are both faster to write and more manageable and flexible once deployed.
Intro to Windows Workflow Foundation (Part 5 of 7): Developing Event Driven State Machine Workflows (Level 300)
State machines used to be something that you had to first draw on paper and then implement in code. This session shows how to use technologies to create event-driven workflows and how to apply this to a typical programming problem. We introduce the concept of a flexible process and show how this can help with modeling real-world processes using state and sequential workflow. Plenty of coding is included to illustrate how you can seamlessly merge state machine design and your code.
Intro to Windows Workflow Foundation (Part 6 of 7): Extending Workflow Capabilities with Custom Activities (Level 300)
It is helpful to think of activities as controls within a workflow, similar to controls used with Microsoft ASP.NET Pages or Microsoft Windows Forms. You can use activities to encapsulate execution logic, communicate with the host and decompose a workflow into reusable components. This session examines the simple process of creating custom activities. If you want to expose activities to other developers designing workflows, you are likely to find this session valuable.
Intro to Windows Workflow Foundation (Part 7 of 7): Developing Rules Driven Workflows (Level 300)
Rules can be a powerful business tool when combined with workflow. In this session, learn how to develop more advanced activities that support the modeling of rich business behavior such as human workflow. Understand when to use rules for business logic, and see how rule policies allow for the description of sophisticated behavior in an integrated and flexible way. This session gives you an interesting insight into the power of using workflow at the core of a line of business application.
خطا و راهنمایی
Error1Cannot create an instance of "Browser"....\Samples\DemosBrowser\MainWindow.xaml99DemosBrowser
Could not find a part of the path 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Pdf\AccountingBalanceSample.pdf'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at PdfRpt.FluentInterface.DataTemplate.get_PdfStreamOutput() in ...\Lib\FluentInterface\DataTemplate.cs:line 605 at PdfRpt.PdfReportDocument.createPdf() in ...\Lib\PdfReportDocument.cs:line 119 at PdfRpt.PdfReportDocument.<runInReleaseMode>b__0(Document pdfDisposable) in ...\Lib\PdfReportDocument.cs:line 113 at PdfRpt.Core.Helper.Guard.SafeUsingBlock[TDisposable,T](TDisposable disposable, Action`1 action, Func`2 unwrapper) in ...\Lib\Core\Helper\Guard.cs:line 91 at PdfRpt.Core.Helper.Guard.SafeUsingBlock[TDisposable](TDisposable disposable, Action`1 action) in ...\Lib\Core\Helper\Guard.cs:line 58 at PdfRpt.PdfReportDocument.runInReleaseMode() in ...\Lib\PdfReportDocument.cs:line 105 at PdfRpt.PdfReportDocument.GeneratePdf(Boolean debugMode) in ...\Lib\PdfReportDocument.cs:line 87 at PdfRpt.FluentInterface.PdfReport.Generate(Action`1 pdfRptFileBuilder, Boolean debugMode) in ...\Lib\FluentInterface\PdfReport.cs:line 90 at PdfReportSamples.AccountingBalanceColumn.AccountingBalanceColumnPdfReport.CreatePdfReport() in ...\Samples\PdfReportSamples\AccountingBalanceColumn\AccountingBalanceColumnPdfReport.cs:line 17
Warning4Could not resolve this reference. Could not locate the assembly "System.Windows.Controls.Toolkit, Version=4.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.SlPdf
Warning5Could not resolve this reference. Could not locate the assembly "System.Windows.Controls.Toolkit.Internals, Version=4.0.5.0, Culture=neutral, PublicKeyToken=2c5c654d367bf4a7". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.SlPdf
Error1The type or namespace name 'BusyIndicator' could not be found (are you missing a using directive or an assembly reference?)...\Samples\SlPdf\SlPdf\obj\Debug\MainPage.g.i.cs3818SlPdf
Warning2The variable 'ex' is declared but never used...\Samples\DemosBrowser\Converters\ShellThumbnailConverter.cs4030DemosBrowser