I want to add new custom attribute to a property, 

the result like that
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id {get; set}

the code is: 
           
            var _module = assembly.MainModule;
            PropertyDefinition property = assemblyType.Properties.Single(t 
=> t.Name == "ID");
            //add Identity attribute
            classCtorInfo = 
typeof(DatabaseGeneratedAttribute).GetConstructor(new Type[] { 
typeof(DatabaseGeneratedOption) });
            result = new CustomAttribute(_module.Import(classCtorInfo));
            result.ConstructorArguments.Add(new 
CustomAttributeArgument(_module.Import(typeof(DatabaseGeneratedOption)), 
DatabaseGeneratedOption.Identity));
            property.CustomAttributes.Add(result);

However, when I run this code, it gives me an error, 

Failed to resolve assembly: 'EntityFramework, Version=6.0.0.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089'

How to fix it?
*
*
*
*

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to