Skip to main content

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) ✅

  1. RodPower - New power ratings (e.g., "Super Heavy")
  2. RodAction - New action types
  3. RodMaterial - New materials (e.g., "Graphene", "Carbon Nanotube")
  4. RodComponentType - New component types (e.g., "Forearm Rest", "Rod Sock")
  5. RodBuildCondition - New condition states
  6. GuideType - New guide types
  7. GuideFrameType - New frame types
  8. GuideRingType - New ring materials (e.g., "Diamond Coated", "Titanium Nitride")
  9. WrapType - New wrap types
  10. WrapPattern - New patterns (e.g., "Zigzag", "Herringbone", "Custom Geometric")
  11. FinishType - New finish types (e.g., "Nano Coating", "Ceramic Coating")
  12. FinishGloss - New gloss levels (e.g., "Ultra Matte", "High Gloss")

Line & Knots (5 enums) ✅

  1. KnotCategory - New knot categories (e.g., "Braid to Wire", "Wire to Leader")
  2. KnotDifficulty - New difficulty levels
  3. SpoolingCondition - New condition states
  4. LineSegmentPlacement - New placement types (e.g., "Shock Absorber", "Transition Buffer")
  5. ConnectionPosition - New connection positions

Rod Building Tools (2 enums) ✅

  1. RodBuildingToolType - New tool types (e.g., "CNC Wrapper", "Automated Finisher")
  2. ToolCondition - New condition states

Fishing Methods (1 enum) ✅

  1. FishingMethod - New fishing techniques (e.g., "Drone Fishing", "Kayak Fishing", "Ice Spearing")

Weather & Environmental (5 enums) ✅

  1. PressureTrend - New pressure trends
  2. PrecipitationType - New precipitation types (e.g., "Freezing Drizzle", "Graupel")
  3. CloudCoverType - New cloud cover types
  4. TideType - New tide types
  5. TideRangeType - New range types

Catch & Verification (7 enums) ✅

  1. CatchCondition - New condition states (e.g., "Stressed", "Healthy")
  2. CatchDisposition - New disposition types (e.g., "Tagged and Released", "Donated to Research")
  3. VerificationType - New verification types
  4. VerificationStatus - New status values (e.g., "Under Review", "Pending Appeal")
  5. VerificationMethod - New verification methods (e.g., "Blockchain Verification", "AI + Expert Hybrid")
  6. RecordType - New record types (e.g., "Regional Tournament Record", "Species-Specific Record")
  7. EvidenceType - New evidence types (e.g., "3D Scan", "Blockchain Hash")
  8. 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

  1. No Code Changes: Add new materials, patterns, types without deployments
  2. User-Defined: Users can create custom categories
  3. Type Safety: Enums still provide compile-time safety
  4. Backward Compatible: Existing code continues to work
  5. Future-Proof: System can evolve without breaking changes
  6. 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!