How does it work?

Much like NHibernate or other models where you do declare meta models in code, you create C# classes that represent your atifacts like so:

public class SimpleHasManyDiagram : ClassDiagram
{
    public SimpleHasManyDiagram()
    {
        this.AddClass();
    }
}
public class Person
{
    public IList Hands { get; set; }
}
public class Hand
{
            
}

Now that you have you a compiled assembly containing NPlant artifacts you have a few options for generating the diagram. The easy is to use NPlat.UI.exe, but we always ship a handy NAnt task that makes generating images in bulk much easier.

Using NPlant.UI.exe

Launch NPlant.UI.exe and open your assembly via the File -> Open menu:

Select the diagram you're interested in viewing:

The left most text box will show you the generated PlantUML. You can generate an image directly from the UI by clicking the Generate button:

A few things to note: This tool assumes you have Java installed and in your PATH (or optionally by specifying it's location via the Options -> Setting menu). It also asssumes you have Graphviz installed (a prereq of PlantUML). Use the Help menu in the UI to help find and install these components.

Using NAnt

NAnt is a .NET port of Ant and is a very popular build scripting tool.

<?xml version="1.0"?>
<project name="test" default="main" basedir=".">
	<loadtasks assembly="..\bin\Debug\NPlant.NAntTasks.dll" />
	
	<property name="plantuml" value="..\bin\Debug\plantuml.jar" />
	<property name="diagram.assembly" value="..\bin\Debug\NPlant.Samples.dll" />
	<property name="out.dir" value="Generation" />
	<property name="java" value="C:\Program Files\Java\jre7\bin\java.exe" />
	<target name="main">
		<nplant assembly="${diagram.assembly}" dir="${out.dir}" java="${java}" plantuml="${plantuml}" clean="true" categorize="namespace" verbose="true" />
	</target>
</project>
    

This will write an image file in the output directory you specified for each diagram found in the assembly you specified.

What's the license?

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

I'm only interested in protecting myself and the effort I've put into this personally. I want to have this as widely available as possible. If this license isn't acceptable for you and your usage, let me know - I would like to try to accommodate you if I can.