Posts

Implementing Missing Features in Entity Framework Core

This is the seventh post in a series of posts about bringing the features that were present in Entity Framework pre-Core into EF Core. The others are: Part 1: Introduction, Find, Getting an Entity’s Id Programmatically, Reload, Local, Evict Part 2: Explicit Loading Part 3: Validations Part 4: Conventions Part 5: Getting the SQL for a Query Part 6: Lazy Loading This time I’m going to cover automatic entity configuration in mapping classes, that is, outside of the DbContext.OnModelCreating method. If you remember, Entity Framework Code First supported having classes inheriting from EntityTypeConfiguration in the same assembly as the context . public interface IEntityTypeConfiguration<T> where T : class { void Configure(EntityTypeBuilder<T> entityTypeBuilder); } The actual implementation goes like this: public static class EntityTypeConfigurationExtensions { private static readonly MethodInfo entityMethod = typeof(ModelBuilder).GetTypeInfo().GetMet...

Return multiple values from methods

In this blog, I am going to explain how tuples can be used in C# 7 on wards to return multiple values. Consider the following code from the console application. The method GetDivisionResults accepts two parameters namely number and divisor and returns two integers that are quotient and remainder. static void Main(string[] args) { int number = 17; int devisor = 5; var result = GetDivisionResults(17, 5); Console.WriteLine(“Quotient is ” + result.Item1); Console.WriteLine(“Remainder is ” + result.Item2); } static (int, int) GetDivisionResults(int number, int divisor) { int quotient = number / divisor; int remainder = number % divisor; return (quotient, remainder); } The following function definition defines a function that returns two integer values as tuples. (int, int) GetDevisionREsults(int number, int devisor) (int, int) – defines the return type of the method, which is a tuple contains two integers. I am not concerned about the logic of the application, but...

LA-RAVEL ROUTE PROTECTION WITH INVOKE-1

So we have our basic yaml configuration file with protection turned on. Say we wanted to add in group and permission checks too. I’ve already talked some about this kind of handling in a different post but I’ve more recently simplified it even more, no longer requiring extra classes in the mix. Let’s start by changing our configuration file to tell Invoke that we want to be sure the user is in the “admin” group and has a permission of “delete_user” to access the /admin/user/delete resource: /admin/user/delete: protected: on groups: [admin] permissions: [delete_user] When you fire off the page request for that URL, Invoke will try to call the InvokeUser::getGroups and InvokeUser::getPermissions methods to return the user’s current permission set. Before it required you to use classes that implemented the InvokeGroup and InvokePermission interfaces for each group/permission. I streamlined this since it’s really only evaluating string matches and allowed those methods to eithe...

.NET CORE LOGGING TO MYSQL USING NLOG

Set up the MySQL database MySQL Workbench can be used to add the schema ‘nlog’ which will be used for logging to the MySQL database. The user ‘damienbod’ is also required, which must match the defined user in the connection string. If you configure the MySQL database differently, then you need to change the connection string in the nlog.config file. You also need to create a log table. The following script can be used. If you decide to use NLog.Web in a ASP.NET Core application and add some extra properties, fields to the logs, then this script needs to be extended and also the database target in the nlog.config. CREATE TABLE `log` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Application` varchar(50) DEFAULT NULL, `Logged` datetime DEFAULT NULL, `Level` varchar(50) DEFAULT NULL, `Message` varchar(512) DEFAULT NULL, `Logger` varchar(250) DEFAULT NULL, `Callsite` varchar(512) DEFAULT NULL, `Exception` varchar(512) DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB ...

ANGULAR LAZY LOADING WITH WEB PACK 2-1

AOT production build The webpack.prod.js file requires that the chunkFilename property is set in the output, so that webpack chunks the lazy load modules. output: { path: ‘./wwwroot/’, filename: ‘dist/[name].[hash].bundle.js’, chunkFilename: ‘dist/[id].[hash].chunk.js’, publicPath: ‘/’ }, The angular-router-loader is added to the loaders. The genDir folder defined here must match the definition in tsconfig-aot.json. module: { rules: [ { test: /\.ts$/, loaders: [ ‘awesome-typescript-loader’, ‘angular-router-loader?aot=true&genDir=aot/’ ] }, JIT development build The webpack.dev.js file requires that the chunkFilename property is set in the output, so that webpack chunks the lazy load modules. output: { path: ‘./wwwroot/’, filename: ‘dist/[name].bundle.js’, chunkFilename: ‘dist/[id].chunk.js’, publicPath: ‘/’ }, The angular-router-loader is added to the loaders. module: { rules: [ { test: /\.ts$/, loaders: [ ‘awesome-typescript-loader’, ...

API Integration

RNaura Services  seamlessly helped in Upgrading and improving several small, medium and big shot sized businesses to develop CRM solutions to help them keep things moving. RNaura Services  CRM professionals are well known name in the industry for their CRM expertise to sync domain business processes with familiar to work and recognition for on time and best quality software delivery. Technologies RNaura Services  has vast experience and knowledge in application development that provides insight into the almost relevant, business annalist information for everyone in your organization. Our potential expertise lie in the customization services that has been achieved by way of delivering various CRM projects for clients spread across the globe. We are using Microsoft Certified ASP.Net, C#, VB.Net, HTML, JScript, JQuery & Silverlight etc. comprehensively along with CRM. Methodology Change management from traditional working model towards CRM Analysis of the c...

.NET Core

Our .Net services includes following: ASP.NET MVC 3/MVC 4 Development Application Migration Latest technology and customized in software application .Net Desktop and Web Application Development .Net web services .Net software product development Microsoft Dynamics CRM RNaura Services  developers’ core expertise lies in web application development with excellent proficient in developing best solution among the market to become trend setter in coding. RNaura Services  has ample of work experience in Microsoft ASP.NET Development and .Net off shoring along with ASP.NET Applications development, we cater programs with asp.net, Asp.net Software Development ecommerce application, customized shopping cart modules development and others third party components in .ASP.NET can be used to deploy dynamic websites, web applications and web services. This application provides advantage for other script base technologies with ASP by combining the server side code for more than...

ECommerce Development

RNaura Services  provide solutions to set up online store with a perfect shopping cart and payment Gateway facilities. E-commerce web development services enable you to sell your products online. The vital aspect of our ecommerce web development. We have successfully delivered professional e-commerce websites to customers from across the GLOBE; we maintain high quality standards and best customer support with timelines to exceed our client expectations. We not only consider all aspects when designing a successful ecommerce site, we can make the whole process of e-commerce less complicated. E Commerce Websites RNaura Services  team will take you step by step through each level of e-Commerce development from secure order processing to final dispatch of goods advising on technology, applications and good practice online trading. We offer various E Commerce services such as: Open source E Commerce integration Payment gateway integration Secure online transaction or shopp...

PHP DEVELOPMENT

RNaura Services  provide custom web development services using PHP open source scripting language Development. Deployed dynamic websites and applications including e-commerce platforms application, real estate, mobile web services, social networking websites and data driven CRM dashboards. RNaura Services  implemented frameworks like CakePHP and CodeIgniter; CMS for dynamic portal likes Joomla, Magento, WordPress and Drupal as well as integration with databases like MySQL and PostgreSQL. RNaura Services  program for various platforms including Linux, Mac, Windows, RISC OS and others. Frameworks RNaura Services  development expertise includes frameworks such as Laravel, CakePHP, Smarty, Symfony, CodeIgniter, Zend, Yii and others.

ASP.NET Core

Our .Net services includes following: ASP.NET MVC 3/MVC 4 Development Application Migration Latest technology and customized in software application .Net Desktop and Web Application Development .Net web services .Net software product development Microsoft Dynamics CRM RNaura Services  developers’ core expertise lies in web application development with excellent proficient in developing best solution among the market to become trend setter in coding. RNaura Services  has ample of work experience in Microsoft ASP.NET Development and .Net off shoring along with ASP.NET Applications development, we cater programs with asp.net, Asp.net Software Development ecommerce application, customized shopping cart modules development and others third party components in .ASP.NET can be used to deploy dynamic websites, web applications and web services. This application provides advantage for other script base technologies with ASP by combining the server side code for more than...