BACKGROUND
As time goes by, I find myself more and more turning to NDepend to gain insight into the design/implementation of legacy applications.
QUESTION
Rather than adding JustMyCode to CQL queries, is there a way to permanently configure NDepend (at the project level) to simply ignore the .NET Framework? I could be wrong, but I am pretty sure that this feature was supported by NDepend v3.
EXAMPLE
Open your solution in Visual Studio and click Rebuild
create an NDepend project based on your solution file (*.sln)
run the Analysis
open the interactive (non-HTML) Dependency Graph
click the Reset arrow in the top left corner (hint: the recycling icon)
click reset to application assemblies only
observe
you will no longer see references to the .Net Framework (note: the blue writing is gone)
right click on one of your assemblies: Select Types
click that I use directly
the following CQL will appears in the queries window:
from t in Types where t.IsUsedBy ("MyCompany.MyProduct.MyAssemblyName") select new { t, t.NbILInstructions }
observe
more than likely you will now see .NET Framework references (note: the blue writing is back) in the query results window
add JustMyCode to the CQL query and the .NET references disappear again: from t in JustMyCode.Types where t.IsUsedBy ("MyCompany.MyProduct.MyAssemblyName") select new { t, t.NbILInstructions }
CONTEXT
Application: NDepend version 4.1.0.6871
View: Dependency Graph
The only two ways to ignore a .NET assemblies are:
Using notmycode/JustMyCode as you wrote
Remove the assembly from the Project Properties > Code to Analyze panel.
Related
I have a lot of projects in Eclipse and I'm trying to tidy it up with something simple like a folder. Is there any way to do this so i can have, for example all projects for a particular client in one collapsable folder?
You can achieve this organization within eclipse without actually changing the filesystem structure of your projects. The feature, to cut to the chase, is called Eclipse Working Sets.
The gist is working sets are groups of projects or resources, and most of the eclipse views (package view, enterprise explorer, navigator, etc) can honor and switch between working sets.
Create a working set of type Resource, select the projects you want, then in the package explorer carat drop down (I'm looking at eclipse Kepler) you can either have the top-level elements be the working sets (e.g. a folder-like view per client) or you can filter out stuff one working set at a time.
Some other uses for working sets might be projects of certain types, Java vs. C++ projects, etc. as outlined in this older tutorial.
I'm using VS 2013 and SQL Svr 2012 and trying use EF to populate a gridview. As this is a very simple test, I have just one table with a key and a couple of data fields. The process of creating the model seems to work fine - it shows as expected in the designer view, the files are created in app_code, a bin folder is created with 2 dlls, and the config file is updated with a connection string and other entries.
When I try to select the "named connection" I get the error "Unable to load the specified metadata resource" and it talks about rebuilding the project to get the assemblies.
I've spent hours reading other cases like this and I can't understand:
Why this is happening when it was never a problem with VS 2010
How do I fix the connection string to point to the resources it wants. I'm totally lost with all the technical advice about fully qualified assembly names - nothing I try works.
How do I set some parameter to force the resources to be in the proper place? All the advice I've read doesn't seem to relate very well with VS 2013
I need to decide if I should just uninstall VS 2013 and use VS 2012. Currently, I'm using VS 2010 with ASP 4.0 and I'd like to move to ASP 4.5 and generally keep up with Microsoft technology. However, I don't have the skill level to deal with a VS release that is buggy. It seems to me that this EF execise could be due to a either a bug or some odd corruption on my computer - I'm trying to figure out which is the case. I installed VS 2013 Express and SQL Svr 2012 on a clean machine that had none of these tools in the past.
I'd really like to see someone who is very familiar with Visual Studio try to replicate my problem as it only takes a few minutes to do so:
In MS SQL Server, create a tiny DB with one table that has a primary key and a couple of data fields and populate with some test data - Call it TinyDB with TestTable1.
Using VS 2013 Express for Web, create an "New Web Site" with the option for "ASP Empty Web Site" using VB.
Add an ASP App_Code Folder containing an "ADO.Net Entity Data Model" and leave the name as "Model".
Generate the model from the DB and make a "New Connection" for "TinyDB" and using Entity Framework 6.0 and then select "TestTable1". Note the namespace is "TinyDBModel". Clicking "Finish" will generate several items in App_Code, other folders and also update web.config.
Add a web form called default.aspx and drag a gridview onto it. In design mode for the gridview, select "new data source" and then the "Entity" option (note name of EntityDataSource1 which appears in default.aspx). Click next and under "named connection" select "TinyDBEntities" - this is where mine gets the error "Unable to load the specified metadata resource".
Note that this exact exercise in VS 2010 works perfectly and produces a grid with the correct data displayed.
Unfortunately, the EntityDataSource control does not work with the latest version of Entity Framework, EF6. Hopefully the control gets an update in a future update version of VS or EF, but for now you can't use the two together.
There are a few solutions / alternatives:
Drop back to EF 5. In order to do this, delete the .edmx and .tt files from the App_Code folder, delete the EF assemblies from the Bin folder, and remove the references to EF from web.config. Then rebuild the site, add a new ADO.NET Entity Model and choose version 5 in the Choose Your Version dialog. Then delete the .tt files from the App_Code folder, open the EDMX diagam, right-click an empty spot and on the Properties Grid set Code Generation Strategy to Legacy ObjectContext. Then rebuild again, and it should work.
Use Model Binding. This is really the recommended solution. The Microsoft / EF team recommends people to stay away from the EntityDataSource control and only use it for Dynamic Data web sites, Model Binding is the preferred solultion. It's pretty clean and straight forward to use, and gives you a lot of control over your queries and object updates. For more info about Model Binding, check out: http://www.asp.net/web-forms/tutorials/data-access/model-binding/retrieving-data
Is it possible to group projects in Eclipse? Or maybe have a project with sub-projects?
Eclipse offers working sets. You can reduce the projects shown in the Package Explorer and other places to whichever projects you defined into the working set. You can also show the union of various sets, and similar gymnastics.
You can define/edit/delete working sets from the little triangle dropdown menu on the Package Explorer and similar directory views.
You have two options, as far as I know:
use the already suggested Working Set option: you can create custom groups, use them to focus on a particular area of a project, activate them through Mylin; a really powerful tool indeed
use the basic concept of workspace which allows you to work on many projects and relate them (via the Build path "Projects" tab, and "Java EE Module Dependencies") so that when you need resources from other projects or you need to deploy them along with your main web application Eclipse will do that for you
Using Working Sets, you can add and organize them as shown in the picture :
As you can see my Java projects are in Working sets like Sem1 and TPs.
When you create an all new Project, just add the project to your working set, like this :
What about eclipse working sets? You define a working set and then add some projects to it. Later you could select a working set and only the projects you selected earlier are shown in project explorer.
Simpl grouping to reduce clutter.
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/cworkset.htm
Since Eclipse Mars M5, you can see a hierarchical view of nested projects in the Project Explorer view. In the view menu, click "Projects Layout > Hierarchical". https://www.eclipse.org/mars/noteworthy/#_nested_hierarchical_view_of_projects
Working sets are great, but they don't work if the projects in one working set has the same name as in another, and such occurs in some TI C2000 chip examples that are in different directories.
People,
My team is just beginning to learn how to use COBOL on Eclipse (as part of the Rational Developer for System Z package) and one of our most desired features are code templates or code snippets.
What we'd like to have is a code completion based on snippets just like we have on Java. For example, when I type try and hit ctrl-space Eclipse shows me a list of completion options, where one of those is create a try/catch block. Well, in COBOL one could leverage this when creating, for example, embedded SQL blocks, like
EXEC SQL
SELECT field, field, field,
FROM table
WHERE field = value,
field = value
END-EXEC.
However, for some reason, it seems that Eclipse treats COBOL a little differently (no wonder why) from other languages. As such, when looking for the code templates in the preferences menu for COBOL, its appearance is very different from the Java one.
The question is: how does one uses Eclipse's code templates with COBOL?
[Fair disclosure - I work for the vendor I mention below]
The answer probably depends on what COBOL & plug-in you're using. If you have the Micro Focus Eclipse product (either the one for Net Express or Server Express, or the Server Express Remote Development Option), the code snippets are supported. There's a number built in but you can also build your own.
You can get more details at http://www.microfocus.com/eclipse/
I'm afraid I don't know how/if other Eclipse plug-ins have similar capabilities.
I've been following this guide from MSDN about "Creating an ASP.NET MVC Areas Application Using Multiple Projects". Since ASP.NET MVC 2.0 is just preview one would imagine there to be some bugs.
My problem is, it simply doesn't work! At least not the way it's suppose to. After setting everything up and pressing F5, one would think that, this will work, neat! BEEEP. Wrong.
It doesn't find the Views in the child project! Because in my case it tries to search within ~/Views which of course is in the parent!
When debugging i see that it Does run the Controller inside my child project, but when using return View(); on that Action, it looks inside the Parent View-folders.
I ask, Bug or Feature?
Tried this in both Vs2009, Vs2010 with both Framework 3.5 and 4.0.
I put "multi project areas" in Google and came accross this post: http://forums.asp.net/p/1494640/3540105.aspx. Note specifically Phil Haack's response.
It appears that defining your views in the parent project is "functioning as designed" because of this entry in the MSDN post: Now that all the code is in place, the final step is to customize the build process for each area project. This customization causes some child-area files, such as the views, to be copied to the main project before the application is built.
The "problem" with the post is that it was defined for the beta where this build step was easily accessable. RC+ you have to point to the Futures assembly and assign the build step slightly differently if this is the path you choose.
If you don't like the direction this pushes you, the portable areas portion of MvcContrib Phil mentions is about as good as you're gonna get to an alternative.
I went through the same pain as you. This is what I did.
Made sure I was running MVC 2 RC (uninstall beta 2, install the RC).
Recreated the project from scratch.
No need to edit the csproj files, no need to create a routes.cs, and no need to edit global.ascx.cs, just right click the main project to get the context menu. From the Add menu item you can create a new area.
The views have to be in the main
project or you can use the
information in this post
http://forums.asp.net/p/1494640/3540105.aspx, which I plan on doing so the views are in each area.
It doesn't support the Multi-Project areas, but for now that's ok with me. The link above does point you in the direction for multi-project areas.