Tooling and Project Concepts
Namespace Layout
Build a namespace and type name from a project feature area.
tooling
Namespaces make related classes easier to locate by grouping them under a project and feature name.
Namespace Layout
NamespaceLayout.cs
Replay: real traced execution (multi-file project)
using System;
class Program
{
static void Main()
{
string feature = "Billing";
string rootNamespace = "Storefront";
string namespaceName = rootNamespace + "." + feature;
string typeName = feature + "Service";
Console.WriteLine($"namespace={namespaceName}");
Console.WriteLine($"type={typeName}");
}
}
using System;
class Program
{
static void Main()
{
string feature = "Orders";
string rootNamespace = "Storefront";
string namespaceName = rootNamespace + "." + feature;
string typeName = feature + "Service";
Console.WriteLine($"namespace={namespaceName}");
Console.WriteLine($"type={typeName}");
}
}
using System;
class Program
{
static void Main()
{
string feature = "Reports";
string rootNamespace = "Storefront";
string namespaceName = rootNamespace + "." + feature;
string typeName = feature + "Service";
Console.WriteLine($"namespace={namespaceName}");
Console.WriteLine($"type={typeName}");
}
}
feature ← Billing, rootNamespace ← Storefront, namespaceName ← Storefront.Billing
4{5 static void Main()6 {7 string feature→ Billing = "Billing"; //@feature="Orders", "Reports"8 string rootNamespace→ Storefront = "Storefront";9 string namespaceName→ Storefront.Billing = rootNamespaceStorefront + "." + featureBilling;10 string typeName→ BillingService = featureBilling + "Service";1112 Console.WriteLine($"namespace={namespaceNameStorefront.Billing}");13 Console.WriteLine($"type={typeNameBillingService}");14 }outputnamespace=Storefront.Billing type=BillingService
feature ← Orders, rootNamespace ← Storefront, namespaceName ← Storefront.Orders
4{5 static void Main()6 {7 string feature→ Orders = "Orders";8 string rootNamespace→ Storefront = "Storefront";9 string namespaceName→ Storefront.Orders = rootNamespaceStorefront + "." + featureOrders;10 string typeName→ OrdersService = featureOrders + "Service";1112 Console.WriteLine($"namespace={namespaceNameStorefront.Orders}");13 Console.WriteLine($"type={typeNameOrdersService}");14 }outputnamespace=Storefront.Orders type=OrdersService
feature ← Reports, rootNamespace ← Storefront, namespaceName ← Storefront.Reports
4{5 static void Main()6 {7 string feature→ Reports = "Reports";8 string rootNamespace→ Storefront = "Storefront";9 string namespaceName→ Storefront.Reports = rootNamespaceStorefront + "." + featureReports;10 string typeName→ ReportsService = featureReports + "Service";1112 Console.WriteLine($"namespace={namespaceNameStorefront.Reports}");13 Console.WriteLine($"type={typeNameReportsService}");14 }outputnamespace=Storefront.Reports type=ReportsService