Posts

Showing posts from September, 2018

Entity Framework

Image
Entity Framework is an object-relational mapper (O/RM) that enables .NET developers to work with a database using .NET objects. It eliminates the need for most of the data-access code that developers usually need to write. It  automate all these database related activities for your application. Entity Framework is an open-source  ORM framework  for .NET applications supported by Microsoft. It enables developers to work with data using objects of domain specific classes without focusing on the underlying database tables and columns where this data is stored. Entity Framework Features Cross-platform:  EF Core is a cross-platform framework which can run on Windows, Linux and Mac. Modelling:  EF (Entity Framework) creates an EDM (Entity Data Model) based on POCO (Plain Old CLR Object) entities with get/set properties of different data types. It uses this model when querying or saving entity data to the underlying database. Querying:  EF allows us to use LINQ queries (C#/VB.NET

Microsoft.EntityFrameworkCore 2.1 with MySql Database

Pomelo.EntityFrameworkCore.MySql need to use MySql Database with  Microsoft.EntityFrameworkCore 2.1. Install-Package Pomelo.EntityFrameworkCore.MySql -Version 2.1.0-rc1-final     public static void ConfigureMYSQLContext(this IServiceCollection services, IConfiguration configuration)         {             var connectionString = configuration.GetConnectionString("MySqlstr");             services.AddDbContext<RepositoryContext>(o => o.UseMySql(connectionString));                     }

Logging Error Details with ELMAH

Error Logging Modules And Handlers (ELMAH) offers another approach to logging runtime errors in a production environment. ELMAH is a free, open source error logging library that includes features like error filtering and the ability to view the error log from a web page, as an RSS feed, or to download it as a comma-delimited file. Ref:  https://docs.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/logging-error-details-with-elmah-cs Ref:  https://docs.elmah.io/logging-to-elmah-io-from-aspnet-core/ Ref:  https://www.infoworld.com/article/3270935/application-development/how-to-use-elmah-for-error-logging-in-aspnet-core.html?upd=1535958949442 Working URL: https://github.com/ElmahCore/ElmahCore Install-Package  elmahcore   //Elmah Configuration         public static void ConfigureElmah(this IServiceCollection services, IConfiguration configuration)         {             services.AddElmah<SqlErrorLog>(options

Microsoft.EntityFrameworkCore 2.0

Entity Framework Core is a lightweight and extensible version of the popular Entity Framework data access technology.  EF Core API creates a database schema based on domain and context classes, without any additional configurations  Commonly Used Types: Microsoft.EntityFrameworkCore.DbContext Microsoft.EntityFrameworkCore.DbSet Ref:  https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db Ref:  https://www.learnentityframeworkcore.com/walkthroughs/existing-database Install-Package Microsoft.EntityFrameworkCore -Version 2.1.2 Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 2.1.2 Install-Package Microsoft.EntityFrameworkCore.Tools Auto Model generation: npm command- Scaffold-DbContext "Server=xxxx;Database=xxx;User id=sa; Password=xx;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models https://stackoverflow.com/questions/50838156/unable-to-resolve-service-for-type-microsoft-entityframeworkcore-storage-irelat Con