Skip to content

Commit

Permalink
Merge pull request #76 from Capgemini/master-scripting-better
Browse files Browse the repository at this point in the history
Master scripting better
  • Loading branch information
reflection-emit authored Oct 31, 2018
2 parents 0b2e622 + d0ac6d5 commit 6a1cf11
Show file tree
Hide file tree
Showing 297 changed files with 5,055 additions and 1,771 deletions.
344 changes: 261 additions & 83 deletions Cauldron.sln

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,26 @@
</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="FodyHelpers, Version=3.2.4.0, Culture=neutral, PublicKeyToken=1ca091877d12ca03, processorArchitecture=MSIL">
<HintPath>..\..\packages\FodyHelpers.3.2.4\lib\net46\FodyHelpers.dll</HintPath>
<Private>False</Private>
<Reference Include="FodyHelpers, Version=3.2.13.0, Culture=neutral, PublicKeyToken=1ca091877d12ca03, processorArchitecture=MSIL">
<HintPath>..\..\packages\FodyHelpers.3.2.13\lib\net46\FodyHelpers.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=1ca091877d12ca03, processorArchitecture=MSIL">
<HintPath>..\..\packages\FodyHelpers.3.2.4\lib\net46\Mono.Cecil.dll</HintPath>
<Private>False</Private>
<HintPath>..\..\packages\FodyHelpers.3.2.13\lib\net46\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=1ca091877d12ca03, processorArchitecture=MSIL">
<HintPath>..\..\packages\FodyHelpers.3.2.4\lib\net46\Mono.Cecil.Mdb.dll</HintPath>
<Private>False</Private>
<HintPath>..\..\packages\FodyHelpers.3.2.13\lib\net46\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=1ca091877d12ca03, processorArchitecture=MSIL">
<HintPath>..\..\packages\FodyHelpers.3.2.4\lib\net46\Mono.Cecil.Pdb.dll</HintPath>
<Private>False</Private>
<HintPath>..\..\packages\FodyHelpers.3.2.13\lib\net46\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.10.0.0, Culture=neutral, PublicKeyToken=1ca091877d12ca03, processorArchitecture=MSIL">
<HintPath>..\..\packages\FodyHelpers.3.2.4\lib\net46\Mono.Cecil.Rocks.dll</HintPath>
<Private>False</Private>
<HintPath>..\..\packages\FodyHelpers.3.2.13\lib\net46\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -64,8 +62,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ComponentAttributeValues.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="Weaver_ComponentCache.cs" />
<Compile Include="FactoryCreateUsages.cs" />
<Compile Include="ComponentCacheWeaver.cs" />
<Compile Include="FactoryTypeInfoWeaver.cs" />
<Compile Include="FactoryTypeInfoWeaverBase.cs" />
<Compile Include="FactoryTypeInfoWeaverDefault.cs" />
<Compile Include="FactoryTypeInfoWeaverGeneric.cs" />
<Compile Include="InjectAttributeValues.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
38 changes: 38 additions & 0 deletions Fody/Cauldron.ActivatorInterceptors/ComponentAttributeValues.cs
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; }
}
Loading

0 comments on commit 6a1cf11

Please sign in to comment.