Class Prop
This class provides methods to generate property path strings from lambda expression.
Inheritance
Inherited Members
Namespace: MongoDB.Entities
Assembly: MongoDB.Entities.dll
Syntax
public static class Prop
Methods
Collection<T>()
Returns the collection/entity name of a given entity type
Declaration
public static string Collection<T>()
where T : IEntity
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T | The type of the entity to get the collection name of |
Elements<T>(Int32, Expression<Func<T, Object>>)
Returns a path with the filtered positional identifier prepended to the property path.
EX: 0, x => x.Rating > a.Rating
EX: 1, x => x.Rating > b.Rating
TIP: Index positions start from '0' which is converted to 'a' and so on.
Declaration
public static string Elements<T>(int index, Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | 0=a 1=b 2=c 3=d and so on... |
Expression<Func<T, Object>> | expression | x => x.SomeProp |
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T |
Elements<T>(Expression<Func<T, Object>>)
Returns a path without any filtered positional identifier prepended to it.
EX: b => b.Tags > Tags
Declaration
public static string Elements<T>(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, Object>> | expression | x => x.SomeProp |
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T |
Path<T>(Expression<Func<T, Object>>)
Returns the full dotted path for a given expression.
EX: Authors[0].Books[0].Title > Authors.Books.Title
Declaration
public static string Path<T>(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, Object>> | expression | x => x.SomeList[0].SomeProp |
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T |
PosAll<T>(Expression<Func<T, Object>>)
Returns a path with the all positional operator $[] for a given expression.
EX: Authors[0].Name > Authors.$[].Name
Declaration
public static string PosAll<T>(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, Object>> | expression | x => x.SomeList[0].SomeProp |
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T |
PosFiltered<T>(Expression<Func<T, Object>>)
Returns a path with filtered positional identifiers $[x] for a given expression.
EX: Authors[0].Name > Authors.$[a].Name
EX: Authors[1].Age > Authors.$[b].Age
EX: Authors[2].Books[3].Title > Authors.$[c].Books.$[d].Title
TIP: Index positions start from [0] which is converted to $[a] and so on.
Declaration
public static string PosFiltered<T>(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, Object>> | expression | x => x.SomeList[0].SomeProp |
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T |
PosFirst<T>(Expression<Func<T, Object>>)
Returns a path with the first positional operator $ for a given expression.
EX: Authors[0].Name > Authors.$.Name
Declaration
public static string PosFirst<T>(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, Object>> | expression | x => x.SomeList[0].SomeProp |
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T |
Property<T>(Expression<Func<T, Object>>)
Returns the name of the property for a given expression.
EX: Authors[0].Books[0].Title > Title
Declaration
public static string Property<T>(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, Object>> | expression | x => x.SomeList[0].SomeProp |
Returns
Type | Description |
---|---|
String |
Type Parameters
Name | Description |
---|---|
T |