Skip to content

Instantly share code, notes, and snippets.

@jogibear9988
Created March 15, 2013 13:36
Show Gist options
  • Save jogibear9988/5169905 to your computer and use it in GitHub Desktop.
Save jogibear9988/5169905 to your computer and use it in GitHub Desktop.
ManyToManyAssociationAttribute
using System;
namespace BLToolkit.Mapping
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple=false)]
public class ManyToManyAssociationAttribute : Attribute
{
private string _thisKey; public string ThisKey { get { return _thisKey; } set { _thisKey = value; } }
private string _otherKey; public string OtherKey { get { return _otherKey; } set { _otherKey = value; } }
private string _storage; public string Storage { get { return _storage; } set { _storage = value; } }
private bool _canBeNull = true; public bool CanBeNull { get { return _canBeNull; } set { _canBeNull = value; } }
private string _relationTableThisKey; public string RelationTableThisKey { get { return _relationTableThisKey; } set { _relationTableThisKey = value; } }
private string _relationTableOtherKey; public string RelationTableOtherKey { get { return _relationTableOtherKey; } set { _relationTableOtherKey = value; } }
private string _relationTableName; public string RelationTableName { get { return _relationTableName; } set { _relationTableName = value; } }
public string[] GetThisKeys () { return Association.ParseKeys(_thisKey); }
public string[] GetOtherKeys() { return Association.ParseKeys(_otherKey); }
public string[] GetRelationTableThisKeys() { return Association.ParseKeys(_relationTableThisKey); }
public string[] GetRelationTableOtherKeys() { return Association.ParseKeys(_relationTableOtherKey); }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment