mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
added marr.datamapper source code for easy debugging.
This commit is contained in:
parent
58a05fcef8
commit
3cdff3bb71
96 changed files with 9198 additions and 363 deletions
61
Marr.Data/Mapping/TableBuilder.cs
Normal file
61
Marr.Data/Mapping/TableBuilder.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Marr.Data.Mapping
|
||||
{
|
||||
/// <summary>
|
||||
/// This class has fluent methods that are used to easily configure the table mapping.
|
||||
/// </summary>
|
||||
public class TableBuilder<TEntity>
|
||||
{
|
||||
private FluentMappings.MappingsFluentEntity<TEntity> _fluentEntity;
|
||||
|
||||
public TableBuilder(FluentMappings.MappingsFluentEntity<TEntity> fluentEntity)
|
||||
{
|
||||
_fluentEntity = fluentEntity;
|
||||
}
|
||||
|
||||
#region - Fluent Methods -
|
||||
|
||||
public TableBuilder<TEntity> SetTableName(string tableName)
|
||||
{
|
||||
MapRepository.Instance.Tables[typeof(TEntity)] = tableName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FluentMappings.MappingsFluentColumns<TEntity> Columns
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_fluentEntity == null)
|
||||
{
|
||||
throw new Exception("This property is not compatible with the obsolete 'MapBuilder' class.");
|
||||
}
|
||||
|
||||
return _fluentEntity.Columns;
|
||||
}
|
||||
}
|
||||
|
||||
public FluentMappings.MappingsFluentRelationships<TEntity> Relationships
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_fluentEntity == null)
|
||||
{
|
||||
throw new Exception("This property is not compatible with the obsolete 'MapBuilder' class.");
|
||||
}
|
||||
|
||||
return _fluentEntity.Relationships;
|
||||
}
|
||||
}
|
||||
|
||||
public FluentMappings.MappingsFluentEntity<TNewEntity> Entity<TNewEntity>()
|
||||
{
|
||||
return new FluentMappings.MappingsFluentEntity<TNewEntity>(true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue