forked from reflection-emit/Cauldron
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from Capgemini/master-scripting-better
Master scripting better
- Loading branch information
Showing
297 changed files
with
5,055 additions
and
1,771 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Fody/Cauldron.ActivatorInterceptors/ComponentAttributeValues.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Cauldron.Interception.Cecilator; | ||
using Mono.Cecil; | ||
using System; | ||
|
||
internal class ComponentAttributeValues | ||
{ | ||
public ComponentAttributeValues(AttributedType attributedType) | ||
{ | ||
if (attributedType.Attribute.Properties.ContainsKey("InvokeOnObjectCreationEvent")) this.InvokeOnObjectCreationEvent = (bool)attributedType.Attribute.Properties["InvokeOnObjectCreationEvent"].Value; | ||
foreach (var item in attributedType.Attribute.ConstructorArguments) | ||
{ | ||
switch (item.Type.FullName) | ||
{ | ||
case "System.String": | ||
this.ContractName = item.Value as string; | ||
break; | ||
|
||
case "System.Type": | ||
this.ContractType = (item.Value as TypeReference)?.ToBuilderType() ?? item.Value as BuilderType ?? Builder.Current.Import(item.Value as Type)?.ToBuilderType(); | ||
break; | ||
|
||
case "System.UInt32": | ||
this.Priority = (uint)item.Value; | ||
break; | ||
|
||
case "Cauldron.Activator.FactoryCreationPolicy": | ||
this.Policy = (int)item.Value; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
public string ContractName { get; } | ||
public BuilderType ContractType { get; } | ||
public bool InvokeOnObjectCreationEvent { get; } | ||
public int Policy { get; } | ||
public uint Priority { get; } | ||
} |
Oops, something went wrong.