Mercurial > pub > bltoolkit
view Source/Patterns/MustImplementAttribute.cs @ 5:f7d63a092920
Исправлено условие Where в тех случаях, когда репозитарий не является генериком
author | cin |
---|---|
date | Tue, 10 Mar 2015 16:02:11 +0300 |
parents | f990fcb411a9 |
children |
line wrap: on
line source
using System; namespace BLToolkit.Patterns { [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Method | AttributeTargets.Property)] public sealed class MustImplementAttribute : Attribute { public MustImplementAttribute(bool implement, bool throwException, string exceptionMessage) { _implement = implement; _throwException = throwException; _exceptionMessage = exceptionMessage; } public MustImplementAttribute(bool implement, bool throwException) : this(implement, throwException, null) { } public MustImplementAttribute(bool implement, string exceptionMessage) : this(implement, true, exceptionMessage) { } public MustImplementAttribute(bool implement) : this(implement, true, null) { } public MustImplementAttribute() : this(true, true, null) { } private readonly bool _implement; public bool Implement { get { return _implement; } } private bool _throwException; public bool ThrowException { get { return _throwException; } set { _throwException = value; } } private string _exceptionMessage; public string ExceptionMessage { get { return _exceptionMessage; } set { _exceptionMessage = value; } } /// <summary> /// All methods are optional and throws <see cref="NotImplementedException"/> at run tune. /// </summary> public static readonly MustImplementAttribute Default = new MustImplementAttribute(false, true, null); /// <summary> /// All methods are optional and does nothing at run tune. /// Return value and all output parameters will be set to appropriate default values. /// </summary> public static readonly MustImplementAttribute Aggregate = new MustImplementAttribute(false, false, null); } }