Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 16, 2012 05:05 AM by abdu292
Jul 15, 2012 06:15 PM|LINK
Jul 15, 2012 08:08 PM|LINK
Use Visual studio's Find (or Find in files) feature, you can even write regex to find a particuar statement.
Jul 15, 2012 08:17 PM|LINK
Jul 15, 2012 08:23 PM|LINK
I don't think you can generate report but it yeah find in files will help you find all uses a particular type and then you can do all formatting in excel.
Jul 15, 2012 08:28 PM|LINK
Jul 16, 2012 02:29 AM|LINK
You can do it programmatically. Please try finding the solution using the code below. Not that this not the complete code for your question, but you may have to refractor the code slightly.
bool isRequired = false;
if (metadata.ContainerType != null)
isRequired = metadata.ContainerType.GetProperty(metadata.PropertyName)
.Length == 1;
Please let me know if you got the solution. Other wise I will try finding some time to write the code for you.
Hope this helps.
Jul 16, 2012 02:46 AM|LINK
Jul 16, 2012 04:03 AM|LINK
Sorry for the late reply.
Did you mean, loop through each model in the models folder, and all the the properties for each model?
(because, I am unsure, why you need to have the loop through the controllers to know the required attribute).
Jul 16, 2012 04:11 AM|LINK
Jul 16, 2012 05:05 AM|LINK
Hi, Here is the code
to get all the models, from the Model folder,
private Type GetTypesInNamespace(Assembly assembly, string nameSpace)
return assembly.GetTypes().Where(t => String.Equals(t.Namespace, nameSpace, StringComparison.Ordinal)).ToArray();
Type typelist = GetTypesInNamespace(Assembly.GetExecutingAssembly(), "YourProjectName.Models");
for (int i = 0; i < typelist.Length; i++)
var modelName = typelist[i].Name;
Taken from from the link : http://stackoverflow.com/questions/949246/how-to-get-all-classes-within-namespace
and here is the code to get all the properties from each model
Employee emp = new Employee();
foreach (var property in emp.GetType().GetProperties())
var myProperty = property;
//Do something with the property
Try putting these together, and achieve your goal. I got very little time, and could not research much on this, but by utilizing all the code above, you should be ablel to achieve it for sure.
Hope this helps.