Posts

DDD Refactoring: Enums++ with Enumeration Classes

  DDD Refactoring: Enums++ with Enumeration Classes Let's refactor ENUMS by moving from traditional ENUM  types to  enumeration classes Understanding Problems with Enums Using C# Enum types has limitations: They are  value types  and cannot have behavior (methods). They cannot hold additional data. They are not easily extensible without modifying the original enum. They don’t support polymorphism. E xample Code public enum OrderStatus { Pending, Shipped, Delivered } I ssues with above code If you need to associate extra info (like display name or code), you need separate mappings. Adding logic (IsFinalStatus ) is impossible inside the Enum. F ix: Use Enumeration Classes Enumeration Classes Enumeration classes are implemented using  sealed classes with static instances . They allow: Adding properties a. Adding methods b. Strong typing c. Extensibility Code Example public sealed class OrderStatus { public string Name { get ; } publi...

Northwind Database

  USE [master] GO /****** Object:  Database [Northwind]    Script Date: 06-03-2021 16:05:39 ******/ CREATE DATABASE [Northwind]  CONTAINMENT = NONE  ON  PRIMARY  ( NAME = N'Northwind', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\northwnd.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )  LOG ON  ( NAME = N'Northwind_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\northwnd.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )  WITH CATALOG_COLLATION = DATABASE_DEFAULT GO ALTER DATABASE [Northwind] SET COMPATIBILITY_LEVEL = 150 GO IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')) begin EXEC [Northwind].[dbo].[sp_fulltext_database] @action = 'enable' end GO ALTER DATABASE [Northwind] SET ANSI_NULL_DEFAULT OFF  GO ALTER DATABASE [Northwind] SET ANSI_NULLS OFF  GO ALTER DATABASE [Northwind] SET ANSI_PADDING OFF  ...

How To Shrink And Fit To Pages When Printing In Outlook?

Image
I n Excel, you do   Fit all columns/rows on One Page . Ever thought h ow do you shrink email message content to fit to printing pagers.  Here's a trick to shrink overflowing message content and fit to pages when printing in Microsoft Outlook. To shrink message content and make it fit to page when printing, in Microsoft Outlook below are the steps: 1 . Open the email message that you want to print by double-clicking it. 2 . Click Actions  (or  Other Actions  in Outlook 2007) and select  View in Browser . NOTE: If the email message is plain text or rich text, you need to convert it to the HTML format before carrying out this Step.  You can convert an email message to the HTML format: A . In Outlook 2010 or later versions, click the  Message  >  Actions  >  Edit Message , then click the  Format Text  >  HTML ; B . In Outlook 2007, click the  Message  >  Other Actions  >  Edit ...

How to Stop Overthinking

Image
Stop Overthinking And Live In The Present! Let me ask you one thing, "How many hours per day do you think?" “I never thought about that,” you’re probably saying.  Haha, you’re thinking all the time, and yet you never consider how much time you spend thinking. That sounds like an addiction to me. I know, because I’m addicted to thinking, too. Overthinking is a common problem, but when it gets out of hand it can lead to sleep disruption, “analysis paralysis,” and even threaten mental health. It’s also a difficult one to diagnose, let alone cure. When I eat too much, I can say, “I’m overeating. I need to eat less.” When I work too much, I can say, “I’m getting burned out. I need to stop working.” When I drink too much, I can say, “I need to stop. I need a bottle of water.” But when I think too much, it’s not enough to just say “I’m overthinking.” I need a different approach to unclog my brain. The problem is that most people don’t consider overthinking a pro...