Interface IRepository
Data repository (data object collection) basic interface
Inherited Members
Namespace: XData
Assembly: XData.docfx.dll
Syntax
public interface IRepository : IDataQuery, IOrderedQueryable, IQueryable, IEnumerable, IDisposable
Properties
| Improve this Doc View SourceCount
Get repository object count
Declaration
long Count { get; }
Property Value
Type | Description |
---|---|
Int64 |
Editable
Get editable state of repository objects
Declaration
bool Editable { get; }
Property Value
Type | Description |
---|---|
Boolean |
FixedQuery
Data repository fixed query
Declaration
bool FixedQuery { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Used to cache record set once (at first call) and have an access to cached data multiple times
Hint: Useful when needed to read the same data multiple times according dynamic rules and all records count approximately equal or less then requests count
Examples
var q = dataScope.GetRepository<Some>().Where(x => x.SomeField == 1);
q.FixedQuery = true;
q.FirstOrDefault(x => x.OtherField == 3); //Queried across the cached data
|
Improve this Doc
View Source
HasCurrentRecord
Check current record is assigned
Declaration
bool HasCurrentRecord { get; }
Property Value
Type | Description |
---|---|
Boolean |
Manual
Manual repository flag
Declaration
bool Manual { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Manual repositories can be filled by attached objects only
Hint: Use manual repositories to build logic filled repositories
Hint: Use manual repositories as mock repositories for testing
Hint: Object attaching (see Attach(T, DataObjectState, IEnumerable<KeyValuePair<String, Object>>, AttachedHandler<T>[])) set Manual property to True automatically
WARNING! Detach objects (see Detach(Predicate<T>)) NOT set Manual property to False automatically!
See Also
ShowSubtree
Data repository tree modifier
Declaration
bool ShowSubtree { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Used to show/hide subtree related items in slave view when master is tree
When ShowSubtree = false - slave contains selected node child items only
When ShowSubtree = true - selected node and it's subtree child items
Works with DirectLink: External links marked as DirectLink is filled while ShowSubtree is false and omitted otherwise
See Also
Methods
| Improve this Doc View SourceClear(DataSubmitFlag)
Clear repository objects
Declaration
bool Clear(DataSubmitFlag flag = DataSubmitFlag.None)
Parameters
Type | Name | Description |
---|---|---|
DataSubmitFlag | flag |
Returns
Type | Description |
---|---|
Boolean |
Remarks
All objects corresponded current repository limitations will be deleted through single operation
WARNING! Trigger logic BeforeDelete and AfterDelete are not used in this case!
Use BeforeClear and AfterClear instead!
CloseChilds()
Close child repositories
Declaration
void CloseChilds()
DetachChild<TChild>(String)
Detach child repository
Declaration
void DetachChild<TChild>(string alias = null)
where TChild : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
String | alias |
Type Parameters
Name | Description |
---|---|
TChild |
FindParent<TParent>(out IRepository<TParent>, String)
Find parent repository
Declaration
bool FindParent<TParent>(out IRepository<TParent> parent, string alias = null)
where TParent : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
IRepository<TParent> | parent | Parent repository |
String | alias | Parent repository alias |
Returns
Type | Description |
---|---|
Boolean | Find success |
Type Parameters
Name | Description |
---|---|
TParent | Parent repository type |
GetChild<TChild>(String, ISecuritySession, Variable[])
Get a child repository
Declaration
IRepository<TChild> GetChild<TChild>(string alias = null, ISecuritySession security = null, params Variable[] variables)
where TChild : class, IDataObject, new()
Parameters
Type | Name | Description |
---|---|---|
String | alias | Child alias |
ISecuritySession | security | Security session |
Variable[] | variables | Child variables |
Returns
Type | Description |
---|---|
IRepository<TChild> | Repository |
Type Parameters
Name | Description |
---|---|
TChild | Child type |
Remarks
If child repository not exists it will be created and linked to base repository as a child
When alias parameter value is not set child object type name used as child repository alias
See Also
| Improve this Doc View SourceRefresh()
Refresh repository data cache
Declaration
void Refresh()