C# – Mapping Enum Types to Entity Properties in the Entity Framework Designer

Enums have implicit numeric indicies. You can change the “seed”: Implies 1, 2, 3 The Entity Framework Designer maps enums to int data types. In Entity Data Model Diagram(edmx) – Right-click column – Select convert to enum – In the Add Enum Type dialog, either: — Select reference external type, enter namespace + type, or…Continue reading “C# – Mapping Enum Types to Entity Properties in the Entity Framework Designer”

C# – Nuget Package Management and No-Commit Workflow

Package Manager – install files, folders, add references to third party packages supplying common functionality. Add dependencies. Update packages and dependencies Tools -> Nuget Package Manager -> Package Manager Console Install-Package elmah Update-Package elmah package.config file keeps track of packages, dependencies and versions. Nuget No-Commit Workflow To restore deleted packages at compile: Solution Explorer ->Continue reading “C# – Nuget Package Management and No-Commit Workflow”

Using a Tools- or Maintenance-Centric Approach to Building a Database Application

Tools-Centric approach / workflow = use Visual Studio’s designers, tools, etc. to build applications w/ minimal code. Great for small, departmental apps with little business logic, change is not anticipated and there is a tight frame. In Contrary, Maintenance-Centric approach  / workflow = Anticipate change, mitigate it’s negative effects on software by separating concerns, applyingContinue reading “Using a Tools- or Maintenance-Centric Approach to Building a Database Application”

C# – Displaying the DbSet Result in an ASP.Net Gridview

Gridview server control – Databinds to enumerable collections of objects and renders in a tabular format. Must call ToList() on DbSet to bind to a databound control. Implementing a Button Command in a GriedView Click Chevron -> GridView Taks -> Edit Columns… BoundField – Databind to a object property ButtonField – Hyperlink Button Handle buttonContinue reading “C# – Displaying the DbSet Result in an ASP.Net Gridview”

C# – Creating a Database and an Entity Model in Visual Studio 2013

Creating Database LocalDb – Local dev-only version of SQL Server Project -> Add New Item…. -> Installed -> Data -> Sql Server Database Createa an .mdf file SQL Server Data Tools (SSDT) -> Tools to create and manage SQL Server databases from Visual Studio. Creating an Entity Model Entity Data Model – Object Relational MapperContinue reading “C# – Creating a Database and an Entity Model in Visual Studio 2013”

C# – Understanding Global Exception Handling

Unhandled exception bubble up until they are exposed to the end user (aka “yellow screen of death”) Best place to handle exception is the nearest locale to the exception itself. However, You CAN handlig globally. In global.asax   Understanding Custom Exceptions Inherit from Exception like so:

C# – First Pass at the Separation of Concern Principle

Separate concers at the mitigate the impact of change on a software system. Common “concerns”: Presentation logic Business / Domain logic Persistence logic Recommendation: Seperate concerns into projects within a given solution. Naming convention: MyApplication(Solution name) MyApplication.Presentation(.Web, etc. presentation project) MyApplication.Domain(domain/business rules project) MyApplication.Persistence(.Data, .DB persistence project)