Skip to content

Commit

Permalink
Added EncryptedAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
vmelamed committed Nov 21, 2015
1 parent 238cff0 commit c9d0dbf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Aspects/EncryptedAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;

namespace vm.Aspects
{
/// <summary>
/// EncryptedAttribute marks a property, field, return value or a parameter as being encrypted.
/// This class cannot be inherited.
/// </summary>
[Serializable]
[AttributeUsage(
AttributeTargets.Field |
AttributeTargets.Property |
AttributeTargets.ReturnValue |
AttributeTargets.Parameter,
AllowMultiple = false,
Inherited = true)]
public sealed class EncryptedAttribute : Attribute
{
/// <summary>
/// Gets a string that can be used to resolve which cipher should be selected from the DI container.
/// </summary>
public string CipherResolver { get; }

/// <summary>
/// Initializes a new instance of the <see cref="EncryptedAttribute"/> class.
/// </summary>
/// <param name="cipherResolver">An optional string that can be used to resolve which cipher should be selected from the DI container.</param>
public EncryptedAttribute(string cipherResolver = null)
{
CipherResolver = cipherResolver;
}
}
}
1 change: 1 addition & 0 deletions Aspects/vm.Aspects.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
<Compile Include="DIContainer.ExtensionsRegister.cs" />
<Compile Include="DIContainer.GenericExtensions.cs" />
<Compile Include="DIContainer.GenericExtensions2.cs" />
<Compile Include="EncryptedAttribute.cs" />
<Compile Include="EnumFlagsExtensions.cs" />
<Compile Include="Exceptions\BusinessException.cs" />
<Compile Include="Exceptions\InvalidObjectException.cs" />
Expand Down

0 comments on commit c9d0dbf

Please sign in to comment.