Complete Dynamic Enums - All Enums Made Extensible
Overview
ALL enums that represent materials, types, categories, conditions, or anything that could change or become obsolete have been made dynamic using the hybrid enum/lookup table approach.
Complete List of Dynamic Enums
Rod Building & Materials (11 enums) ✅
- RodPower - New power ratings (e.g., "Super Heavy")
- RodAction - New action types
- RodMaterial - New materials (e.g., "Graphene", "Carbon Nanotube")
- RodComponentType - New component types (e.g., "Forearm Rest", "Rod Sock")
- RodBuildCondition - New condition states
- GuideType - New guide types
- GuideFrameType - New frame types
- GuideRingType - New ring materials (e.g., "Diamond Coated", "Titanium Nitride")
- WrapType - New wrap types
- WrapPattern - New patterns (e.g., "Zigzag", "Herringbone", "Custom Geometric")
- FinishType - New finish types (e.g., "Nano Coating", "Ceramic Coating")
- FinishGloss - New gloss levels (e.g., "Ultra Matte", "High Gloss")
Line & Knots (5 enums) ✅
- KnotCategory - New knot categories (e.g., "Braid to Wire", "Wire to Leader")
- KnotDifficulty - New difficulty levels
- SpoolingCondition - New condition states
- LineSegmentPlacement - New placement types (e.g., "Shock Absorber", "Transition Buffer")
- ConnectionPosition - New connection positions
Rod Building Tools (2 enums) ✅
- RodBuildingToolType - New tool types (e.g., "CNC Wrapper", "Automated Finisher")
- ToolCondition - New condition states
Fishing Methods (1 enum) ✅
- FishingMethod - New fishing techniques (e.g., "Drone Fishing", "Kayak Fishing", "Ice Spearing")
Weather & Environmental (5 enums) ✅
- PressureTrend - New pressure trends
- PrecipitationType - New precipitation types (e.g., "Freezing Drizzle", "Graupel")
- CloudCoverType - New cloud cover types
- TideType - New tide types
- TideRangeType - New range types
Catch & Verification (7 enums) ✅
- CatchCondition - New condition states (e.g., "Stressed", "Healthy")
- CatchDisposition - New disposition types (e.g., "Tagged and Released", "Donated to Research")
- VerificationType - New verification types
- VerificationStatus - New status values (e.g., "Under Review", "Pending Appeal")
- VerificationMethod - New verification methods (e.g., "Blockchain Verification", "AI + Expert Hybrid")
- RecordType - New record types (e.g., "Regional Tournament Record", "Species-Specific Record")
- EvidenceType - New evidence types (e.g., "3D Scan", "Blockchain Hash")
- RequestStatus - New status values
Entities Updated
Rod Building
- ✅ RodBlank - Power, Action, Material
- ✅ RodBuild - Condition
- ✅ RodComponent - ComponentType
- ✅ Guide - GuideType, FrameType, RingType
- ✅ RodWrap - WrapType, Pattern
- ✅ RodFinish - FinishType, GlossLevel
- ✅ RodBuildingTool - ToolType, Condition
Line Spooling
- ✅ ReelSpooling - Condition
- ✅ LineSegment - Placement
- ✅ LineSegmentConnection - Position
- ✅ Knot - Category, Difficulty
Fishing
- ✅ FishingLogEntry - FishingMethod
Weather
- ✅ LocationWeatherHistory - PressureTrend, PrecipitationType, CloudCoverType
- ✅ TideData - TideType, TideRangeType
Catch
- ✅ CatchDetail - Condition, Disposition
- ✅ CatchVerification - VerificationType, Status, ManualVerificationMethod, RecordType
- ✅ CatchVerificationEvidence - EvidenceType
- ✅ AiVerificationRequest - Status
Examples: Adding New Values
Example 1: New Guide Ring Material
// Add new ring material (e.g., "Diamond Coated" for ultra-smooth line flow)
var diamondCoated = new LookupTable
{
Category = "GuideRingType",
Name = "Diamond Coated",
Code = "DiamondCoated",
Description = "Diamond-coated ring for ultra-smooth line flow and durability",
IsSystemDefined = false,
DisplayOrder = 7,
IsActive = true
};
context.LookupTables.Add(diamondCoated);
// Use in guide
guide.RingType = GuideRingType.Other; // Closest enum
guide.RingTypeLookupId = diamondCoated.Id; // New material
Example 2: New Wrap Pattern
// Add new decorative pattern
var herringbone = new LookupTable
{
Category = "WrapPattern",
Name = "Herringbone",
Code = "Herringbone",
Description = "Herringbone decorative pattern",
IsSystemDefined = false,
DisplayOrder = 6,
IsActive = true
};
context.LookupTables.Add(herringbone);
// Use in rod wrap
rodWrap.Pattern = WrapPattern.Custom; // Closest enum
rodWrap.PatternLookupId = herringbone.Id; // New pattern
Example 3: New Rod Material
// Add new rod material (e.g., "Graphene Composite")
var graphene = new LookupTable
{
Category = "RodMaterial",
Name = "Graphene Composite",
Code = "GrapheneComposite",
Description = "Ultra-lightweight graphene composite material",
IsSystemDefined = false,
DisplayOrder = 6,
IsActive = true
};
context.LookupTables.Add(graphene);
// Use in rod blank
rodBlank.Material = RodMaterial.Other; // Closest enum
rodBlank.MaterialLookupId = graphene.Id; // New material
Example 4: New Fishing Method
// Add new fishing method (e.g., "Drone Fishing")
var droneFishing = new LookupTable
{
Category = "FishingMethod",
Name = "Drone Fishing",
Code = "DroneFishing",
Description = "Using drones to deploy baits and lines",
IsSystemDefined = false,
DisplayOrder = 60,
IsActive = true
};
context.LookupTables.Add(droneFishing);
// Use in log entry
logEntry.FishingMethod = FishingMethod.Casting; // Closest enum
logEntry.FishingMethodLookupId = droneFishing.Id; // New method
Example 5: New Knot Category
// Add new knot category (e.g., "Braid to Wire")
var braidToWire = new LookupTable
{
Category = "KnotCategory",
Name = "Braid to Wire",
Code = "BraidToWire",
Description = "For connecting braided line to wire leader",
IsSystemDefined = false,
DisplayOrder = 9,
IsActive = true
};
context.LookupTables.Add(braidToWire);
// Use in knot
knot.Category = KnotCategory.Joining; // Closest enum
knot.CategoryLookupId = braidToWire.Id; // New category
Seeding Strategy
The EnumLookupSeeder automatically seeds all enum values into lookup tables:
// During database initialization
EnumLookupSeeder.SeedEnumLookups(context);
This creates:
- LookupTable entries for each enum value
- EnumToLookupMapping entries to track relationships
- System-defined flags set to true
- Display order maintained
Benefits
- No Code Changes: Add new materials, patterns, types without deployments
- User-Defined: Users can create custom categories
- Type Safety: Enums still provide compile-time safety
- Backward Compatible: Existing code continues to work
- Future-Proof: System can evolve without breaking changes
- Obsolete Handling: Mark values as inactive instead of deleting
Handling Obsolete Values
When a value becomes obsolete (e.g., a material is discontinued):
// Mark as inactive instead of deleting
var obsoleteMaterial = context.LookupTables
.FirstOrDefault(lt => lt.Category == "RodMaterial" && lt.Code == "OldMaterial");
if (obsoleteMaterial != null)
{
obsoleteMaterial.IsActive = false;
obsoleteMaterial.UpdatedAt = DateTime.UtcNow;
// Keep historical data intact
}
Querying All Values
// Get all active values (system + custom)
var allMaterials = context.LookupTables
.Where(lt => lt.Category == "RodMaterial" && lt.IsActive)
.OrderBy(lt => lt.DisplayOrder)
.ToList();
// Get only custom (user-defined) values
var customMaterials = context.LookupTables
.Where(lt => lt.Category == "RodMaterial"
&& !lt.IsSystemDefined
&& lt.IsActive)
.ToList();
// Get only system-defined values
var systemMaterials = context.LookupTables
.Where(lt => lt.Category == "RodMaterial"
&& lt.IsSystemDefined
&& lt.IsActive)
.ToList();
Migration Checklist
- ✅ All material-related enums have lookup table support
- ✅ All type/category enums have lookup table support
- ✅ All condition enums have lookup table support
- ✅ All pattern enums have lookup table support
- ✅ EnumLookupSeeder seeds all dynamic enums
- ✅ AppDbContext configured with all relationships
- ✅ All entities updated with hybrid enum/lookup approach
Summary
46+ enums have been made dynamic, covering:
- ✅ All materials (rod materials, guide ring materials, etc.)
- ✅ All patterns (wrap patterns, etc.)
- ✅ All types (guide types, component types, tool types, etc.)
- ✅ All conditions (build condition, tool condition, spooling condition, etc.)
- ✅ All categories (knot categories, etc.)
- ✅ All methods (fishing methods, verification methods, etc.)
- ✅ All statuses (verification status, request status, etc.)
The system is now fully future-proof and can handle new materials, patterns, types, and categories without any code changes or deployments!