locked
Migration of asp.net web application 4.5 framework project to .net core 3.1 RRS feed

  • Question

  • User190551098 posted

    Hi Team,

    I am migrating asp.net web application 4.5 framework project to .net core 3.1 so what would be architecture do i need to follow please find my observation below

    1> Do i need to register all services in ConfigureServices below as I have many services

    public void ConfigureServices(IServiceCollection services) { <mark style="box-sizing: inherit; min-width: calc(100% + 2rem); min-height: 18.9px; padding: 0px 1rem; margin: 0px -1rem; display: inline-block; color: var(--text); background-color: var(--code-highlight-background); font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"> services.AddDbContext<TodoContext>(opt => opt.UseInMemoryDatabase("TodoList"));</mark> services.AddControllers(); }

    2>Do I need to write all function inside Configure

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }

    Sunday, May 3, 2020 7:15 AM

All replies

  • User475983607 posted

    Your post indicates that you have little to no ASP.NET Core 3.1 experience.   

    The standard startup.cs file configures the HTTP pipeline and registers application features, usually called services, with the Dependency injection framework.  These are application features like the EF DbContext, Authentication, Authorization, Routes, and any custom service that supports your business logic.  

    I recommend that you set aside time to go through the ASP.NET Core fundamentals docs before moving forward.  I also recommend building a few  Core applications to get some experience.

    https://docs.microsoft.com/en-us/aspnet/core/fundamentals/?view=aspnetcore-3.1&tabs=windows

    1> Do i need to register all services in ConfigureServices below as I have many services

    Yes, the standard pattern is writing services and registering the services in the ConfigureServices method.  Constructor injection is used to create the services that you'll use in controller, razor pages, and custom classes. 

    2>Do I need to write all function inside Configure

    I'm not sure what you are asking.  The Configure() method is used to configure the HTTP pipeline.  This is where authorization and routing is found to name a few.

    Sunday, May 3, 2020 10:44 AM
  • User-854763662 posted

    Hi omsaisaanvi ,

    As mgebhard suggested , You must first know key topics for developing ASP.NET Core apps according to the link mgebhard provided.

    And for migrating from ASP.NET to ASP.NET Core, you could learn the below links for a reference guide

    https://docs.microsoft.com/en-us/aspnet/core/migration/proper-to-2x/?view=aspnetcore-3.1

    https://hackernoon.com/how-to-migrate-project-from-aspnet-mvc-to-aspnet-core-qt1ks31zn

    Best Regards,

    Sherry

    Monday, May 4, 2020 7:58 AM