SPRNET-843 - VS.NET 2008 project and solutions templates

This commit is contained in:
markpollack
2009-07-31 22:16:41 +00:00
parent 112d7f4dfd
commit 104ee5ec78
11 changed files with 184 additions and 73 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -16,7 +16,12 @@
* limitations under the License.
*/
-->
<chapter xml:id="vsnet" xmlns="http://docbook.org/ns/docbook" version="5">
<chapter version="5" xml:id="vsnet" xmlns="http://docbook.org/ns/docbook"
xmlns:ns5="http://www.w3.org/1999/xhtml"
xmlns:ns4="http://www.w3.org/2000/svg"
xmlns:ns3="http://www.w3.org/1998/Math/MathML"
xmlns:ns2="http://www.w3.org/1999/xlink"
xmlns:ns="http://docbook.org/ns/docbook">
<title>Visual Studio.NET Integration</title>
<sect1 xml:id="vsnet-config-section">
@@ -24,21 +29,17 @@
<title>XML Editing and Validation</title>
<para>Most of this section is well travelled territory for those familiar
with editing XML files in their favorite XML editor. The XML configuration
data that defines the objects that Spring will manage for you are
validated against the Spring.NET XML Schema at runtime. The location of
the XML configuration data to create an
<literal>IApplicationContext</literal> can be any of the resource
locations supported by Spring's <literal>IResource</literal>
abstraction. (See <xref linkend="objects-iresource" /> for more
information.) To create an <literal>IApplicationContext</literal>
using a "standalone" XML configuration file the custom configuration
section in the standard .NET application configuration would read:</para>
locations supported by Spring's <literal>IResource</literal> abstraction.
(See <xref linkend="objects-iresource" /> for more information.) To create
an <literal>IApplicationContext</literal> using a "standalone" XML
configuration file the custom configuration section in the standard .NET
application configuration would read:</para>
<programlisting language="myxml">&lt;spring&gt;
@@ -48,15 +49,15 @@
&lt;/spring&gt;</programlisting>
The VS.NET 2005 XML editor can use the attribute
<literal>xsi:schemaLocation</literal>
as a hint to associate the physical location of a schema file with the XML document being edited. VS.NET 2002/2003 do not recognize the
<literal>xsi:schemaLocation</literal>
element. If you reference the Spring.NET XML schema as shown below, you can get intellisense and validation support while editing a Spring configuration file in VS.NET 2005. In order to get this functionality in VS.NET 2002/2003 you will need to register the schema with VS.NET or include the schema as part of your application project.
<para>The VS.NET 2005 or later, the XML editor uses the attribute
<literal>xsi:schemaLocation</literal> as a hint to associate the physical
location of a schema file with the XML document being edited. VS.NET
2002/2003 do not recognize the <literal>xsi:schemaLocation</literal>
element. If you reference the Spring.NET XML schema as shown below, you
can get intellisense and validation support while editing a Spring
configuration file in VS.NET 2005/2008. In order to get this functionality
in VS.NET 2002/2003 you will need to register the schema with VS.NET or
include the schema as part of your application project. </para>
<programlisting language="myxml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;objects xmlns="http://www.springframework.net"
@@ -71,52 +72,66 @@
...
&lt;/objects&gt;</programlisting>
<para>It is typically more convenient to install the schema in VS.NET,
even for VS.NET 2005, as it makes the xml a little less verbose and you
don't need to keep copying the XSD file for each project you create. For
VS.NET 2003 the schema directory will be either</para>
even for VS.NET 2005/2008, as it makes the xml a little less verbose and
you don't need to keep copying the XSD file for each project you create.
For VS.NET 2003 the schema directory is </para>
<table>
<title />
<para><literal>C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\Packages\schemas\xml</literal> for VS 2003</para>
<tgroup cols="2">
<thead>
<row>
<entry align="center">Visual Studio Version </entry>
<entry align="center">Directory to put Spring .XSD files </entry>
</row>
</thead>
<para>or</para>
<tbody>
<row>
<entry>VS.NET 2003</entry>
<entry>
<literal>C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\Packages\schemas\xml</literal>
</entry>
</row>
<para><literal>C:\Program Files\Microsoft Visual Studio
.NET\Common7\Packages\schemas\xml</literal> for VS.NET 2002</para>
<row>
<entry>VS.NET 2005</entry>
<entry>
<literal>C:\Program Files\Microsoft Visual Studio
8\Xml\Schemas</literal>
</entry>
</row>
<para>The VS.NET 2005 directory for XML schemas is</para>
<row>
<entry>VS.NET 2008</entry>
<entry>
<literal>C:\Program Files\Microsoft Visual Studio
9.0\Xml\Schemas</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
<literal>C:\Program Files\Microsoft Visual Studio
8\Xml\Schemas</literal>
</para>
<table>
<title />
</table>
<para>Spring's .xsd schemas are located in the directory doc/schema. In
that directory is also a NAnt build file to help copy over the .xsd files
to the appropriate VS.NET locations. To execute this script simply type
'<literal>nant</literal>' in the doc/schema directory.</para>
<para>Once you have registered the schema with VS.NET you can adding only
the namespace declaration to the objects element,</para>
<para>
<programlisting language="myxml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;objects xmlns="http://www.springframework.net"&gt;
@@ -138,17 +153,12 @@
targetSchema property in the Property Sheet for the configuration
file.</para>
<para>As shown in the section <xref linkend="objects-factory-client" />
Spring.NET supports using .NET's application configuration file as the
location to store the object definitions that will be managed by the
object factory.</para>
<programlisting language="myxml">
&lt;configuration&gt;
<programlisting language="myxml">&lt;configuration&gt;
&lt;configSections&gt;
&lt;sectionGroup name="spring"&gt;
@@ -174,48 +184,149 @@
<para>In this case VS.NET 2002/2003 will still provide you with
intellisense help but you will not be able to fully validate the document
as the entire schema for App.config is not known. To be able to validate
this document one would need to install the <ulink
<para>In this case VS.NET 2003 will still provide you with intellisense
help but you will not be able to fully validate the document as the entire
schema for App.config is not known. To be able to validate this document
one would need to install the <ulink
url="http://www.radsoftware.com.au/articles/intellisensewebconfig.aspx">.NET
Configuration File schema</ulink> and an additional schema that
incorporates the <literal>&lt;spring&gt;</literal> and
<literal>&lt;context&gt;</literal> section in addition to the
<literal>&lt;objects&gt;</literal> would need to be created.</para>
<para>Validating schema is a new feature in VS 2005 it is validating all
the time while you edit, you will see any errors that it finds in the
Error List window.</para>
<para>Validating schema is a new feature in VS 2005 or later. It is
validating all the time while you edit, you will see any errors that it
finds in the Error List window.</para>
<para>Keep these trade offs in mind as you decide where to place the bulk
of your configuration information. Conventional wisdom is do quick
prototyping with App.config and use another IResource location, file or
embedded assembly resource, for serious development.</para>
</sect1>
<sect1>
<title>XML Type Completion in VS.NET using Resharper</title>
<para>Resharper supports intellisence completion for the value of the type
attribute when editing Spring's XML files. The key combination is
Shift+Alt+Space. This is shown below for the case of specifying the type
of a DAO object in the NHibernate sample application </para>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-type-completion-1.png"></imagedata>
</imageobject>
</mediaobject>
<para>You start to type the name of the class and will get a filter list.
In this case we are typing HibernateOrderDao.</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-type-completion-2.png"></imagedata>
</imageobject>
</mediaobject>
<para>Hittingn 'enter' will then insert the fully qualfied type name with
the namespace but not the assembly reference. To add the assembly
reference either hit 'CTRL+ENTER" or select the yellow 'light bulb' to and
select 'add module qualification'.</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-type-completion-3.png"></imagedata>
</imageobject>
</mediaobject>
<para>You will need to remove the extraneous 'Verstion' information. This
will leave you with the following object definition.</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-type-completion-4.png"></imagedata>
</imageobject>
</mediaobject>
<para>If you use Spring's autowiring functionality, then you can even
avoid having to type the property information when referring to
collaborating objects. See <xref linkend="objects-factory-autowire" />.
for more information on autowiring.</para>
</sect1>
<sect1>
<title>Resharper templates</title>
<para>Resharper offers live templates for assistance while coding as well
as file templates. Spring 1.3 provides a few of each type to help you be
more efficient when performing common configuration related tasks. To
install the templates follow the directions in the 'dev-support'
directory. One installed the following templates are available</para>
<para></para>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-live-templates.png"></imagedata>
</imageobject>
</mediaobject>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-file-templates.png"></imagedata>
</imageobject>
</mediaobject>
<para>For example, to set a property reference for the object definition
from the previous chapter, type 'odref' and you will be prompted to hit
'tab' to complete the XML fragment.</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-property-ref-1.png"></imagedata>
</imageobject>
</mediaobject>
<para>Hitting tab will generate the XML to use for an object property
values, object constructors and object definitions. </para>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-property-ref-2.png"></imagedata>
</imageobject>
</mediaobject>
<para>You will need to type the name of the property and name of the
reference. Unfortunately, intellisence for property completion and ref
completion is not available. Typing the missing information in then leaves
the completed object definition.</para>
<mediaobject>
<imageobject>
<imagedata fileref="images/resharper-property-ref-3.png"></imagedata>
</imageobject>
</mediaobject>
<para>There are similar live templates for object definitions, object
property values, and object constructors.</para>
</sect1>
<sect1 xml:id="vsnet-schema-versions">
<title>Versions of XML Schema</title>
<para>The schema was updated from Spring 1.0.1 to 1.0.2 in order to
support generics. The schema for version 1.0.1 is located under
<literal>http://www.springframework.net/xsd/1.0.1/</literal> The schema
for the latest version will always be located under
<literal>http://www.springframework.net/xsd/</literal></para>
<para>The latest version of the schema will always be located under
<literal>http://www.springframework.net/xsd/ </literal>The filename of the
.xsd files contains the first Spring.NET version to which they apply.
</para>
</sect1>
<sect1 xml:id="vsnet-api-help">
<title>Integrated API help</title>
<title>API documentation</title>
<para>Spring provides API documentation that can be integrated within
Visual Studio. There are two versions of the documentation, one for VS.NET
2002/2003 and the other for VS 2005. They differ only in the format
applied, VS 2005 using the sexy new format. Enjoy!</para>
Visual Studio. There are two versions of the documentation, one for .NET
1.1 and one for .NET 2.0/3.0. They differ only in the format applied and
the versions of VS.NET that supported. There is also standalone HTMLHELP
format API documentation. You will need to download the help file
seperately from the distribution. </para>
</sect1>
</chapter>
</chapter>