Giter Site home page Giter Site logo

markjprice / cs7dotnetcore2 Goto Github PK

View Code? Open in Web Editor NEW
80.0 12.0 66.0 137.13 MB

Repository for the Packt Publishing book titled "C# 7.1 and .NET Core 2.0" by Mark J. Price

C# 75.36% CSS 0.87% JavaScript 3.44% Ruby 0.02% PowerShell 0.07% TypeScript 6.01% HTML 14.23%

cs7dotnetcore2's Introduction

cs7dotnetcore2's People

Contributors

dependabot[bot] avatar markjprice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cs7dotnetcore2's Issues

Solutions to exercises

Hi Mark, you mentioned that readers can find all solutions to the exercises for this book in this repo, however, I looked through all the folders couldn't find them. Could you tell me where can I find the solutions?

GetStreamAsync().Result hangs UI thread.

Hi Mark,

I believe code in CategoriesViewModel that asks for service response is very bad example and shouldn't be shown as such. Generally we shouldn't await in UI thread. UI should be responsive.
From my perspective this example works only because HTTP response is from localhost, not remote server. Just add Thread.Sleep(5000) and see app hang for 5 seconds.

There are many articles on the internet treating this as potential UI deadlock situation, example:
https://medium.com/bynder-tech/c-why-you-should-use-configureawait-false-in-your-library-code-d7837dce3d7f
For me it was only long await time, not a deadlock but still.

I believe the right solution is to firstly create empty ObservableCollection. Then, create simple task (important it's worker, not UI thread) and run code that's in constructor. No awaits. When request is completed fill Categories collection (still in task) using CoreApplication.MainView.Dispatcher.RunAsync to access it via UI thread.
Since it is ObservableCollection once task is finished collection will be updated automatically.

Hope it helps,
Myfero

Part3 : The customers list only shown once and disappeared

In the part 3:
The response of customers data only shown once and disappeared.
I saw the error message like the following:

No 'Access-Control-Allow-Origin' header is present on the requested resource.

I tested the snippet on the book

public void ConfigureServices(IServiceCollection services)
        {
services.AddCors();

..}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
  app.UseCors(c=>c.WithOrigins("Http://localhost:5002"));
  //          app.UseCors("AllowAllOrigins");
            app.UseMvc();
}

I cannot get the customers' data.help please, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.