You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+98-6Lines changed: 98 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ MongoFramework tries to bring some of the nice features from Entity Framework in
16
16
Some of the major features include:
17
17
- Entity mapping for collections, IDs and properties through attributes
18
18
- Indexing through attributes (including text and geospatial)
19
+
- Fluent mapping builder
19
20
- Entity change tracking
20
21
- Changeset support (allowing for queuing multiple DB updates to run at once)
21
22
- Diff-updates (only _changes_ to an entity to be written)
@@ -43,20 +44,75 @@ Supports profiling database reads and writes, pushing the data into [MiniProfile
43
44
44
45
## Documentation
45
46
46
-
### Core Entity Mapping
47
-
The core mapping of entities and their properties is automatic however there are certain attributes you can apply to your properties to alter this behaviour.
48
-
These attributes (and a few others) are part of the `System.ComponentModel.Annotations` package.
47
+
### Entity Mapping Basics
48
+
The core mapping of entities and their properties is automatic however you have the choice of using the fluent mapping builder or certain attributes to alter this behaviour.
For attribute mapping, many of the core attributes are part of the `System.ComponentModel.Annotations` package.
49
97
50
98
|Attribute|Description|
51
99
|---------|-----------|
52
100
|`[Table("MyFancyEntity", Schema = "MyNamespace")]`|Map the Entity to the collection specified. When a schema is specified, it is prefixed onto the name with a "." (dot) separator.|
53
101
|`[Key]`|Map the property as the "Id" for the entity. Only required if your key doesn't have a common name like "Id" etc.|
54
-
|`[NotMapped]`|Unmaps the property from the entity when reading/writing.|
102
+
|`[NotMapped]`|When applied to a class or property, skips mapping when reading/writing.|
55
103
|`[Column("NewColumnName")]`|Remaps the property with the specified name when reading/writing.|
56
104
57
105
### Indexing
58
-
MongoFramework supports indexing specified through the `IndexAttribute` class. This is applied to the properties you want indexed and will apply the changes to the database when the context is saved.
106
+
MongoFramework supports indexing specified through both the fluent mapping builder and the `IndexAttribute`.
107
+
This is applied to the properties you want indexed and will apply the changes to the database when the context is saved.
@@ -77,9 +134,44 @@ The following variations of indexes are supported across various property types:
77
134
To support compound indexes, define indexes with the same name across multiple properties.
78
135
When doing this, you will want to control the order of the individual items in the compound index which is available through the `IndexPriority` property on the attribute.
79
136
137
+
For fluent mapping, you can specify multiple indexes in one declaration to combine them and handle nesting for complex data structures including through arrays.
MongoFramework supports [Text](https://docs.mongodb.com/manual/core/index-text/) and [2dSphere](https://docs.mongodb.com/manual/core/2dsphere/) special indexes.
82
-
These special index types are selected through the `IndexType` property on the Index attribute.
174
+
For attribute mapping, these special index types are selected through the `IndexType` property on the `IndexAttribute`.
83
175
84
176
Please consult MongoDB's documentation on when the indexes are appropriate and their restrictions.
0 commit comments