Posts

Practices for Clean & Secure Code Repositories

Your code repository is your most valuable asset, it represents the timeline and story behind what you’re building. It serves as your backup in case something goes wrong, which is why it’s essential to keep it as clean and organized as possible. Here are some best practices you can follow to achieve that for both private and public repos: ## The main contains the latest code always I’m a fan of using GitHub Flow for code management. Unlike the traditional Git Flow, where you have multiple main branches (one branch per environment), GitHub Flow has only one main branch. Other branches are used exclusively for feature development. The main branch always contains the latest code merged from feature branches. However, this doesn’t necessarily mean the code is already in production; it simply reflects the most up-to-date work from the developers. By following this approach, you ensure a single source of truth for the latest code and a single branch to deploy from. Even fixes ...

Adapting a New Technology: A General Guide to keep Your Systems up-to-date

Image
Special Thanks to [Mohamed Othman](https://www.linkedin.com/in/mohammad-othman-55351b20b/) for his help in editing this blog. ## Introduction If you are generally working in the technology sector and specifically in the software industry, you will be under stress by the number of new things that are coming up every day. New stuff can be a new integration technology, a new framework, a language version upgrade, or even a new library that helps you to do specific tasks in your code. In this article we will refer to those as: "new Tech". And if you are like me, you will feel messed up if you don't know or know how to use the new trend! So here, I will list some tips and tricks, along with best practices for keeping your projects up-to-date. **Note**: the tips in this article for when and how to implement the new technology in your daily working projects are not concerned about keeping your knowledge up to date, knowing things and doing them are two different t...

Adding Multiple DB Contexts in your DotNet Project

Introduction  In this article we will discuss adding multiple DB contexts to our DotNet projects, we will use EF core as our ORM to make a "Code First Database" approach.  In this article example, we will use DotNet 7 connecting to SQL Server through EF Core 7, all of this will be in a web API project to see how to define those DB contexts as services in program.cs  file.  You can download the example source code from here .  Why would we need multiple DB Contexts in our Solution?  There are two situations where you need multiple DB Context in your project or Solution:  We have a single database but need multiple  schemas in our database, and each scheme will have a group of entities.  We have Multiple databases and our project needs to connect them to do its operations.  We will take the first situation as our code example. Creating Our models Let's assume we have a si...

How to Automatically deploy Configuration Files with Azure DevOps CD pipelines

Introduction Part of the CI/CD Automation is to add environment-related configuration files through deployment automatically, rather than manually uploading them. This will provide less human error and more security by splitting the developer's responsibility of knowing the environment configuration or editing it, as to be handled by Operation side. We will take an example of CI for DotNet Core 6 WebApi project, and on that project, we need to copy the related appsetting.json to its environment. Pre-Requested Knowledge: To benefit from this article you need to be familiar with the following:  Azure DevOps. the Concept of CI/CD. Azure CI/CD Pipelines. DotNet Core Web Api Deployment (or similar). Adding From Source Code Branch In some cases, we will have configuration files included in our source code, for example, in...

Build Multiple Repositories with Single Pipeline Introduction in Azure DevOps

Image
  This section discusses how to build multiple Repositories with a single pipeline. this could be needed when the feature you deliver may affect multiple code repositories and you need to ensure that all build together. The  resources  Section on the Pipeline To tell the pipeline about the other repositories that need to be built, you need to add the  resources  section before starting  steps  or  jobs  sections. let's see the  resources  section structure: resources : repositories : - repository : <RepositoryAliasName> type : git name : <AzureDevOps-ProjectName>/<RepositoryName> ref : <BranchName> The  resources  section contain sub-section  repositories , which contains one or multiple repository definitions. For each repository we need to define the following: repository  the value will be an alias name for the repository, this name will be used on another pip...

Writing code is a mind and time-consuming process, a short story to prove

 Two days ago, while I’m trying to test a Customer module that I had codded, testing some data insertion from my code, I found out my insertion code on exception does not roll-back the insertion, I use to make this kind of transaction handling  at the DBMS on the sorted procedures, but I decided to make this from my code this time, so I searched that, and on C# .net you can use what called TransactionScope , which I implemented successfully, I wasted another hour on reading about the other types of transactions that available on .net framework, implicit and explicit , on one method or through the whole methods and across threads, “I hated threads!” I said, “Let's check about it … no! let’s get focused”.  So I continued my tests and based on some new requirements that I just remembered to do, I have to add forging a key relationship between the Customer table and Company table, that each customer MUST be linked to a company that s/he worked at, this is a simple change, r...

Troubleshoot something you don't know!

One day, three years ago, I found my self supporting users that working on a solution/system for call center department called Avaya Elite, and somehow, I suppose not only to operationally support the system but also to make web application & desktop application that integrates with the earlier mentioned solution. The idea was simple, we have a solution that controls the Telephone Transactions on the company, part of its tools is a desktop application linked with an application server that's controlling the Inbound call center and the Outbound call Center . for the client desktop application, we need to link it with an application that shows information about the caller (in case of inbound) or information about the one who will be called (in case of outbound) from the company's ERP. The above was an overview, as I will not go farther in details on this, but I will describe the situation that I faced: There was no documentation provided from the solution supplier...