using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Marr.Data.Mapping
{
///
/// This class has fluent methods that are used to easily configure the table mapping.
///
public class TableBuilder
{
private FluentMappings.MappingsFluentEntity _fluentEntity;
public TableBuilder(FluentMappings.MappingsFluentEntity fluentEntity)
{
_fluentEntity = fluentEntity;
}
#region - Fluent Methods -
public TableBuilder SetTableName(string tableName)
{
MapRepository.Instance.Tables[typeof(TEntity)] = tableName;
return this;
}
public FluentMappings.MappingsFluentColumns Columns
{
get
{
if (_fluentEntity == null)
{
throw new Exception("This property is not compatible with the obsolete 'MapBuilder' class.");
}
return _fluentEntity.Columns;
}
}
public FluentMappings.MappingsFluentRelationships Relationships
{
get
{
if (_fluentEntity == null)
{
throw new Exception("This property is not compatible with the obsolete 'MapBuilder' class.");
}
return _fluentEntity.Relationships;
}
}
public FluentMappings.MappingsFluentEntity Entity()
{
return new FluentMappings.MappingsFluentEntity(true);
}
#endregion
}
}