mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -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
75
Marr.Data/Mapping/Strategies/AttributeMapStrategy.cs
Normal file
75
Marr.Data/Mapping/Strategies/AttributeMapStrategy.cs
Normal file
|
@ -0,0 +1,75 @@
|
|||
/* Copyright (C) 2008 - 2011 Jordan Marr
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using Marr.Data.Converters;
|
||||
using Marr.Data.Parameters;
|
||||
|
||||
namespace Marr.Data.Mapping.Strategies
|
||||
{
|
||||
/// <summary>
|
||||
/// Maps fields or properties that are marked with the ColumnAttribute.
|
||||
/// </summary>
|
||||
public class AttributeMapStrategy : ReflectionMapStrategyBase
|
||||
{
|
||||
public AttributeMapStrategy()
|
||||
: base()
|
||||
{ }
|
||||
|
||||
public AttributeMapStrategy(bool publicOnly)
|
||||
: base(publicOnly)
|
||||
{ }
|
||||
|
||||
public AttributeMapStrategy(BindingFlags flags)
|
||||
: base(flags)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Registers any member with a ColumnAttribute as a ColumnMap.
|
||||
/// <param name="entityType">The entity that is being mapped.</param>
|
||||
/// <param name="member">The current member that is being inspected.</param>
|
||||
/// <param name="columnAtt">A ColumnAttribute (is null of one does not exist).</param>
|
||||
/// <param name="columnMaps">A list of ColumnMaps.</param>
|
||||
/// </summary>
|
||||
protected override void CreateColumnMap(Type entityType, MemberInfo member, ColumnAttribute columnAtt, ColumnMapCollection columnMaps)
|
||||
{
|
||||
if (columnAtt != null)
|
||||
{
|
||||
ColumnMap columnMap = new ColumnMap(member, columnAtt);
|
||||
columnMaps.Add(columnMap);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers any member with a RelationshipAttribute as a relationship.
|
||||
/// </summary>
|
||||
/// <param name="entityType">The entity that is being mapped.</param>
|
||||
/// <param name="member">The current member that is being inspected.</param>
|
||||
/// <param name="relationshipAtt">A RelationshipAttribute (is null if one does not exist).</param>
|
||||
/// <param name="relationships">A list of Relationships.</param>
|
||||
protected override void CreateRelationship(Type entityType, MemberInfo member, RelationshipAttribute relationshipAtt, RelationshipCollection relationships)
|
||||
{
|
||||
if (relationshipAtt != null)
|
||||
{
|
||||
Relationship relationship = new Relationship(member, relationshipAtt);
|
||||
relationships.Add(relationship);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue