Giter VIP home page Giter VIP logo

aspnetcoregraphql-myhotel's People

Contributors

ebicoglu 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

aspnetcoregraphql-myhotel's Issues

Build fails

Build of this example application fails with the following error message. Any thoughts or help will be appreciated.

Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(79, 5): rzc discover exited with code -2147450730.

'Mapper' does not contain a definition for 'Initialize'

This error is thrown in the below code snippet for Startup.cs:

private static void InitializeMapper()
{
    Mapper.Initialize(x =>
    {
        x.CreateMap<Guest, GuestModel>();
        x.CreateMap<Room, RoomModel>();
        x.CreateMap<Reservation, ReservationModel>();
    });
}

This is probably because Mapper.Initialize is obsolete since version v9.0.0.

Move database configuration to config file instead of hardcoding

Use:

services.AddDbContext<MyHotelDbContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:MyHotelDb"]));

And define appsettings .Development.json like:

"ConnectionStrings": {
    "MyHotelDb": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=MyHoteDbl;Trusted_Connection=True;MultipleActiveResultSets=true"
  },

Code difference in blog and repository

Code for ReservationRepository.cs is different.

In the blog:

public async Task<List<T>> GetAll<T>()
{
    return await _myHotelDbContext
        .Reservations
        .Include(x => x.Room)
        .Include(x => x.Guest)
        .ProjectTo<T>()
        .ToListAsync();
}

In the repository:

public async Task<List<T>> GetAll<T>()
{
    return await GetQuery().ProjectTo<T>().ToListAsync();
}

Which one to use? Is the blog outdated or the repo?

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.