Navigation Properties
Table Of Contents
What Are Navigation Properties?
Navigation Properties(or Nav Props) are C# representations of Foreign Keys between tables in a database.
They represent parent child relationships between the entities.
For example a Customer might have a Nav Prop called Orders. That represent the orders belonging to the customer
When The Sharp Factory App generates the C# code in your Visual Studio Solution; it will automatically generate Nav Props in your entities.
These Nav Props are actual strongly types properties. They can be a single object or a list of objects depending on the relationship of the entities.
Navigation Property Enum
When The Sharp Factory App generates the C# code in your solution, amongst other things, it generates a collection of enumerations that represent all the navigation properties of each entity.
The naming convention is EntityName + NavProperty. For example an Entity called Customer will have a corresponding enum called CustomerNavProperty.
Navigation Properties And Query
To craft your Query to populate navigation properties of your entities.
Start by creating an instance of the Query class passing the Property Enum as the first generic type and then pass the Nav Property Enum as the second generic type parameter.
The following code illustrates how to pull a list of customers along with their orders
Fluent Syntax
Builder Syntax
The previous examples are equivalent. The only difference is the syntax.