DO NOT DOWNLOAD. DOWNLOAD LATEST STABLE FROM RELEASE TAB
Merging Linq to Umbraco into the main project for 4.1 [TFS Changeset #55083]
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--Created with Liquid XML Studio - FREE Community Edition 7.0.5.906 (http://www.liquid-technologies.com)-->
|
||||
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="DocumentTypes">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" name="DocumentType">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Repesents an Umbraco Document Type and its known properties</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:complexContent mixed="false">
|
||||
<xs:extension base="BaseStructure">
|
||||
<xs:sequence>
|
||||
<xs:element name="Description" type="xs:string" />
|
||||
<xs:element name="Properties">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" name="Property">
|
||||
<xs:complexType>
|
||||
<xs:complexContent mixed="false">
|
||||
<xs:extension base="BaseStructure">
|
||||
<xs:sequence>
|
||||
<xs:element name="Mandatory" type="xs:boolean" />
|
||||
<xs:element name="RegularExpression" type="xs:string" />
|
||||
<xs:element name="Type" type="xs:string" />
|
||||
<xs:element name="ControlId" type="xs:string" />
|
||||
<xs:element name="Description" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="Associations">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" name="Association" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="ParentId" type="xs:int" use="required" />
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="DataContextName" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Name prefix for the DataContext that will be generated</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string" />
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Serialization" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Serialization mode of the generated classes</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="None" />
|
||||
<xs:enumeration value="Unidirectional" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="PluralizeCollections" type="xs:boolean" use="required" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:complexType name="BaseStructure">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pairing of ID and Name</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:sequence>
|
||||
<xs:element name="Id" type="xs:int" />
|
||||
<xs:element name="Name" type="xs:string" />
|
||||
<xs:element name="Alias" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--Created with Liquid XML Studio 6.1.18.0 - FREE Community Edition (http://www.liquid-technologies.com)-->
|
||||
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:complexType name="nodeType">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" name="data">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="alias" type="xs:string" use="required" />
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="unbounded" name="node" type="nodeType" />
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:int" use="required" />
|
||||
<xs:attribute name="version" type="xs:string" use="required" />
|
||||
<xs:attribute name="parentID" type="xs:int" use="required" />
|
||||
<xs:attribute name="level" type="xs:int" use="required" />
|
||||
<xs:attribute name="writerID" type="xs:int" use="required" />
|
||||
<xs:attribute name="creatorID" type="xs:int" use="required" />
|
||||
<xs:attribute name="nodeType" type="xs:int" use="required" />
|
||||
<xs:attribute name="template" type="xs:int" use="required" />
|
||||
<xs:attribute name="sortOrder" type="xs:int" use="required" />
|
||||
<xs:attribute name="createDate" type="xs:dateTime" use="required" />
|
||||
<xs:attribute name="updateDate" type="xs:dateTime" use="required" />
|
||||
<xs:attribute name="nodeName" type="xs:string" use="required" />
|
||||
<xs:attribute name="urlName" type="xs:string" use="required" />
|
||||
<xs:attribute name="writerName" type="xs:string" use="required" />
|
||||
<xs:attribute name="creatorName" type="xs:string" use="required" />
|
||||
<xs:attribute name="nodeTypeAlias" type="xs:string" use="required" />
|
||||
<xs:attribute name="path" type="xs:string" use="required" />
|
||||
</xs:complexType>
|
||||
<xs:element name="root">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="node" type="nodeType" />
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:int" use="required" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,769 @@
|
||||
<!DOCTYPE umbraco[
|
||||
<!ELEMENT nodes ANY>
|
||||
<!ELEMENT node ANY>
|
||||
<!ATTLIST node id ID #REQUIRED>
|
||||
]>
|
||||
<root id="-1">
|
||||
<node id="1048" version="d76c30e9-8c89-47e3-bd64-f7e0620f2b87" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1045" template="1042" sortOrder="2" createDate="2008-05-02T09:52:36" updateDate="2009-02-24T12:43:20" nodeName="Runway Homepage" urlName="runway-homepage" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="RunwayHomepage" path="-1,1048">
|
||||
<data alias="bodyText">
|
||||
<![CDATA[
|
||||
<p>Runway gives you a bare-bones website that introduces you to a
|
||||
set of well-defined conventions for building an umbraco
|
||||
website.</p>
|
||||
|
||||
<p>The Runway website is very simple in form and provided without
|
||||
any design or functionality. By installing Runway, you'll begin
|
||||
with a minimal site built on best practices. You'll also enjoy the
|
||||
benefits of speaking the same "language" as the rest of the umbraco
|
||||
community by using common properties and naming conventions.</p>
|
||||
|
||||
<p>Now that you know what Runway is, it is time to get started
|
||||
using Runway.</p>
|
||||
|
||||
<?UMBRACO_MACRO macroAlias="ContactForm" />
|
||||
|
||||
<p>AJAX Loader:</p>
|
||||
|
||||
<?UMBRACO_MACRO macroAlias="AjaxLoader" />
|
||||
]]>
|
||||
</data>
|
||||
<data alias="siteName">Runway</data>
|
||||
<data alias="siteDescription"><![CDATA[Off to a great start]]></data>
|
||||
<node id="1049" version="ace8cba9-338e-4153-bb07-0177df9352d7" parentID="1048" level="2" writerID="0" creatorID="0" nodeType="1046" template="1044" sortOrder="1" createDate="2008-06-01T23:12:54" updateDate="2009-02-24T12:28:28" nodeName="Installing runway modules" urlName="installing-runway-modules" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="RunwayTextpage" path="-1,1048,1049">
|
||||
<data alias="bodyText">
|
||||
<![CDATA[<p>Runway modules encapsulate specific bits of advanced functionality that are easily added to your website.</p>
|
||||
<p>Once installed, Runway Modules are open source and easy to customize if you want to modify the behavior for your specific needs. <br />Because Runway modules are provided under the MIT license you are free to use and modify them any way you want, with no strings attached.</p>
|
||||
<p>To add Runway modules to your website, go to the <strong>Developer</strong> section, expand the <strong>Packages</strong> item and click <strong>Install Runway modules</strong>.</p>
|
||||
<p>Runwau modules are available for various kinds of navigation, a sitemap, and a contact form. The list of available Runway modules is growing rapidly and is automatically updated from a central source, always fresh and current.</p>
|
||||
<p><a href="http://umbraco.org/redir/Runway/aboutUmbraco">Get more information</a> about the umbraco way.</p>]]>
|
||||
</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
<node id="1050" version="8250593e-3aa1-40ab-bbac-86908346f061" parentID="1048" level="2" writerID="0" creatorID="0" nodeType="1046" template="1044" sortOrder="2" createDate="2008-06-01T23:14:52" updateDate="2009-02-24T12:28:28" nodeName="Go further" urlName="go-further" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="RunwayTextpage" path="-1,1048,1050">
|
||||
<data alias="bodyText">
|
||||
<![CDATA[<p>Runway only scratches the surface of what’s possible with umbraco. Below Runway and its modules lies a great architecture that lets you implement whatever you need.</p>
|
||||
<p>With umbraco you’ve finally got a solid, open and reliable platform for websites as simple as a Runway site, and umbraco can be rapidly expanded to support multi-language websites, collaboration platforms and intra/extranets, to name just a few.</p>
|
||||
<p>Advanced functionality is created with umbraco macros, built with XSLT and umbraco’s award-winning .NET integration, including full support for any .NET User or Custom control. Create and integrate your own .NET macros in mere minutes with point and click simplicity. Simply copy your controls to the umbraco website, go to the <strong>Developer</strong> section and create a new macro, selecting your control from the list.</p>
|
||||
<p>We’ve also gathered the best community macros into a repository that’s also accessed from the <strong>Developer</strong> section, in the <strong>Packages</strong> area. You can find more information <a href="http://umbraco.org/redir/Runway/macros">about creating macros</a>, on the umbraco website.</p>
|
||||
<p>The sky is the limit with umbraco, and you have the benefit a friendly community, training, and guaranteed support. Find out how to <a href="http://umbraco.org/redir/Runway/support">get help</a>.</p>]]>
|
||||
</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
<node id="1051" version="317d8fee-a3ce-465b-8cec-3b385d5f6444" parentID="1048" level="2" writerID="0" creatorID="0" nodeType="1046" template="1044" sortOrder="3" createDate="2008-06-01T23:11:56" updateDate="2009-02-24T12:28:28" nodeName="Getting started" urlName="getting-started" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="RunwayTextpage" path="-1,1048,1051">
|
||||
<data alias="bodyText">
|
||||
<![CDATA[<p>You’ve installed umbraco and a minimal Runway website.</p>
|
||||
<p>Edit the text on the homepage and create a site structure by adding new texpages to your site. This is all done in the <strong>Content</strong> section.</p>
|
||||
<p>If you find the editing options provided by Runway too limited for you needs, simply add more properties to the page by going to the <strong>Settings</strong> section, expanding the <strong>Document Types</strong> item and adding new properties on the <strong>Generic Properties</strong> tab. You can find more information about <a href="http://umbraco.org/redir/Runway/documentTypes">document types and properties</a> at the umbraco website.</p>
|
||||
<p>But mostly you’ll probably want to personalize your site by changing the current design. This is also done in the <strong>Settings</strong> section, by editing the CSS styles and HTML templates. Umbraco uses master templates, so the main, common markup is placed in the <strong>Runway Master</strong> template, while the Homeage and Textpage have separate templates for their unique layouts. You can find more information about <a href="http://umbraco.org/redir/Runway/templates">templates and css</a> in umbraco at the umbraco website.</p>
|
||||
<p>Once you’re happy with your site’s design, you might want to add more functionality, such as automated navigation. This is done by <a href="/installing-nitros">installing Runway modules</a>.</p>]]>
|
||||
</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
</node>
|
||||
<node id="1054" version="d0841c5e-8819-428b-9862-fabe04ddd22e" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1052" template="0" sortOrder="3" createDate="2009-02-24T12:50:00" updateDate="2009-02-24T12:50:32" nodeName="People" urlName="people" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Content Folder" path="-1,1054">
|
||||
<node id="1055" version="48949e3d-b103-4801-8e11-e9d0f6303dc5" parentID="1054" level="2" writerID="0" creatorID="0" nodeType="1053" template="0" sortOrder="1" createDate="2009-02-24T12:50:11" updateDate="2009-02-24T12:50:35" nodeName="Aaron" urlName="aaron" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Person" path="-1,1054,1055">
|
||||
<data alias="FirstName">Aaron</data>
|
||||
<data alias="LastName">Powell</data>
|
||||
</node>
|
||||
<node id="1056" version="7d42b11c-7aae-461e-a17a-862d82549728" parentID="1054" level="2" writerID="0" creatorID="0" nodeType="1053" template="0" sortOrder="2" createDate="2009-02-24T12:50:46" updateDate="2009-02-24T12:50:55" nodeName="Bart" urlName="bart" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Person" path="-1,1054,1056">
|
||||
<data alias="FirstName">Bart</data>
|
||||
<data alias="LastName">Simpson</data>
|
||||
</node>
|
||||
<node id="1057" version="9786afbd-bf54-43a1-ae41-2fa4d91aa441" parentID="1054" level="2" writerID="0" creatorID="0" nodeType="1053" template="0" sortOrder="3" createDate="2009-02-24T12:51:00" updateDate="2009-02-24T12:51:09" nodeName="Homer" urlName="homer" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Person" path="-1,1054,1057">
|
||||
<data alias="FirstName">Homer</data>
|
||||
<data alias="LastName">Simpson</data>
|
||||
</node>
|
||||
<node id="1058" version="fb025f86-9ffb-40b6-8cd9-badfe7d4fad1" parentID="1054" level="2" writerID="0" creatorID="0" nodeType="1053" template="0" sortOrder="4" createDate="2009-02-24T12:51:25" updateDate="2009-02-24T12:51:31" nodeName="Lisa" urlName="lisa" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="Person" path="-1,1054,1058">
|
||||
<data alias="FirstName">Lisa</data>
|
||||
<data alias="LastName">Simpson</data>
|
||||
</node>
|
||||
</node>
|
||||
<node id="1098" version="58bf4556-d9b0-4dc4-a9e9-fb74c26d42f9" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1084" template="1069" sortOrder="4" createDate="2009-02-26T18:39:39" updateDate="2009-04-07T08:31:39" nodeName="Home" urlName="home" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Home" path="-1,1098">
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="siteName">Your logo/name</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p><strong>Sam Grady</strong> designed <strong>this for Warren
|
||||
Buckley.</strong> "This" idea was first created by the incredible
|
||||
Robert Brownjohn and has been copied many times since.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="homepagePhoto">/media/49/home_photo.jpg</data>
|
||||
<data alias="bodyText">
|
||||
<![CDATA[
|
||||
<p>Thank you for installing the umbraco website package created and
|
||||
developed by Warren Buckley. This website package should be used to
|
||||
help you understand how all the components of an Umbraco site
|
||||
works.</p>
|
||||
]]>
|
||||
</data>
|
||||
<node id="1099" version="7d9982e5-ae3b-43b4-b61f-1203e03d178e" parentID="1098" level="2" writerID="0" creatorID="0" nodeType="1088" template="1076" sortOrder="1" createDate="2009-02-26T18:47:46" updateDate="2009-04-07T08:31:40" nodeName="About" urlName="about" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Textpage" path="-1,1098,1099">
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[This is the META description for the about page.]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[about, creative web specialist, umbraco, warren buckley, sam grady]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>This is a good place to put a service message or something to
|
||||
help define your site or company.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="articlePhoto">
|
||||
</data>
|
||||
<data alias="bodyText">
|
||||
<![CDATA[
|
||||
<p><strong>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
Aliquam ullamcorper condimentum lorem. Curabitur placerat nunc ut
|
||||
leo. Integer eros ligula, vestibulum at, eleifend id, dignissim
|
||||
vel, est.</strong></p>
|
||||
|
||||
<p>Fusce tristique. Cras faucibus porta nunc. Aliquam ultrices,
|
||||
arcu quis ornare sagittis, lectus augue ornare nulla, eu lobortis
|
||||
velit lectus id nibh. Aliquam condimentum aliquet purus. Quisque
|
||||
blandit ante non sapien. Sed justo libero, sollicitudin ac, pretium
|
||||
et, luctus nec, nisl. Nulla semper neque nec magna. Cras ut nibh ut
|
||||
urna bibendum sodales. Quisque venenatis euismod lacus.
|
||||
Pellentesque dapibus turpis at urna.</p>
|
||||
|
||||
<h3>Sub Header</h3>
|
||||
|
||||
<p>Sed scelerisque adipiscing mauris. Mauris egestas dapibus quam.
|
||||
Integer in libero eget eros dignissim pretium. Proin luctus sem nec
|
||||
lorem. Praesent lorem. Vivamus eget nunc quis sapien condimentum
|
||||
egestas. Maecenas facilisis, nunc at sodales facilisis, quam magna
|
||||
pretium nibh, vel ultrices lectus lorem quis neque. Nam sit amet
|
||||
leo ac lectus gravida convallis. Phasellus at enim vel dui porta
|
||||
porttitor. Morbi id dolor adipiscing erat egestas consequat.</p>
|
||||
|
||||
<p><a href="http://www.google.co.uk">Phasellus diam. Morbi
|
||||
dolor.</a> Donec consequat sodales nunc. Nam dapibus lectus id
|
||||
lectus. Sed ultrices metus sit amet est. Morbi porttitor. Proin vel
|
||||
risus. Phasellus sodales convallis justo. <em>Sed luctus hendrerit
|
||||
risus. Sed est lorem, feugiat et, rutrum quis, condimentum non,
|
||||
nunc.</em> Aenean urna leo, sagittis a, commodo eget, lobortis nec,
|
||||
eros. Vivamus pharetra, lectus eu ultrices pulvinar, nunc quam
|
||||
consectetur nibh, sed pulvinar leo dolor ut felis.</p>
|
||||
|
||||
<ol>
|
||||
<li>Item one</li>
|
||||
|
||||
<li>Item two</li>
|
||||
|
||||
<li>Item three</li>
|
||||
</ol>
|
||||
|
||||
<p>Nullam lobortis, mi nec feugiat congue, dolor diam cursus lacus,
|
||||
a elementum ligula dolor vitae sem. Suspendisse at quam. Praesent
|
||||
neque. Vestibulum at justo. Nulla rutrum velit et eros.</p>
|
||||
|
||||
<ul>
|
||||
<li>Integer convallis augue in tellus</li>
|
||||
|
||||
<li>Magna quam sollicitudin mauris</li>
|
||||
</ul>
|
||||
|
||||
<p>Nullam lobortis, mi nec feugiat congue, dolor diam cursus lacus,
|
||||
a elementum ligula dolor vitae sem. Suspendisse at quam.</p>
|
||||
]]>
|
||||
</data>
|
||||
<node id="1100" version="e10f3703-4af1-461d-baff-060d1f6c5e4e" parentID="1099" level="3" writerID="0" creatorID="0" nodeType="1088" template="1076" sortOrder="1" createDate="2009-02-26T18:51:52" updateDate="2009-04-07T08:31:40" nodeName="About Umbraco" urlName="about-umbraco" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Textpage" path="-1,1098,1099,1100">
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>It's the <strong>KING</strong> of all CMS's, what more do you
|
||||
need to know about it?</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="articlePhoto">/media/171/umbraco_tshirt.jpg</data>
|
||||
<data alias="bodyText">
|
||||
<![CDATA[
|
||||
<h3>Umbraco CMS is free</h3>
|
||||
|
||||
<p>It means that you are not bound and locked to the licensing
|
||||
rules about the number of content items / processors / web /
|
||||
domains, etc. Many products are very expensive as the license cost
|
||||
escalates with the number of websites. In many cases, one is soon
|
||||
up in the 500' before one can even start to implement the
|
||||
solution.</p>
|
||||
|
||||
<h3>Umbraco is Open Source</h3>
|
||||
|
||||
<p>In an Open Source product one has at any time full access to
|
||||
source code. This provides insight and leads to better quality, as
|
||||
"shortcuts" and bad code can easily be penetrated. Moreover, one
|
||||
has the ability to influence and further develop the product.</p>
|
||||
|
||||
<p>Umbraco is based on open source and is therefore not
|
||||
lisence-plated or subject to an enterprise's ownership. The Umbraco
|
||||
publishing tool places great emphasis on simplicity, standards,
|
||||
flexibility and integration. Umbraco was launched in 2005 and has
|
||||
had a tremendous growth since that time. Umbraco is today among the
|
||||
most popular systems based on open source for Microsoft. NET
|
||||
platform.</p>
|
||||
|
||||
<h3>100% Microsoft .NET</h3>
|
||||
|
||||
<p>Umbraco is built 100% on the Microsoft. NET 2.0. This means that
|
||||
you can use 3rd party .NET components directly in Umbraco.
|
||||
Moreover, integration with other .NET-based solutions is well
|
||||
adapted from Umbracos part. Umbraco won an award for the
|
||||
Integration possibilities on BNP Awards 2006.</p>
|
||||
|
||||
<h3>Fast results</h3>
|
||||
|
||||
<p>Umbraco is a powerful tool with a focus on core functionality
|
||||
and openness. This efficiently allows you to achieve exactly what
|
||||
you want - rather than be restricted to a "finished" module, which
|
||||
makes only half of what you really wanted.</p>
|
||||
|
||||
<h3>Easy-to-use</h3>
|
||||
|
||||
<p>Umbraco has a focus on content and facilitate rapid and
|
||||
intuitive content management. The system strives to be elegant,
|
||||
usable and effective.</p>
|
||||
|
||||
<h3>Based on standards</h3>
|
||||
|
||||
<p>Umbraco is based on standards from the W3C as XHTML, CSS, XML
|
||||
and XSLT. This gives a greater flexibility and independence, which
|
||||
in turn provides more value for the money.</p>
|
||||
|
||||
<h3>Integration</h3>
|
||||
|
||||
<p>Umbraco is known to be among the best CMS on integration. Much
|
||||
of the reason for this is the way to expose Microsoft ASP.NET
|
||||
components as elements of, or so-called "macro's" for use in
|
||||
templates, as well as in the WYSIWYG editor that writers and
|
||||
editors use. Elements is also possible to "cache" on several levels
|
||||
and is based on standard Microsoft .NET technology. Below are some
|
||||
examples:</p>
|
||||
|
||||
<ul>
|
||||
<li>External XML sources (ex RSS) can be directly implemented via
|
||||
XSLT elements (macros).</li>
|
||||
|
||||
<li>ASP.NET controls that retrieve data from external or internal
|
||||
posterior systems via standard Web Services.</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p> </p>
|
||||
]]>
|
||||
</data>
|
||||
</node>
|
||||
<node id="1101" version="535d77b2-0e18-449c-8f29-c9e16f854e1d" parentID="1099" level="3" writerID="0" creatorID="0" nodeType="1089" template="1077" sortOrder="2" createDate="2009-02-26T18:56:06" updateDate="2009-04-07T08:31:41" nodeName="About this project" urlName="about-this-project" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_TextpageTwoCol" path="-1,1098,1099,1101">
|
||||
<data alias="articlePhotoColOne">/media/227/warren-buckley.jpg</data>
|
||||
<data alias="articlePhotoColTwo">/media/228/sam-grady.jpg</data>
|
||||
<data alias="bodyTextColTwo">
|
||||
<![CDATA[
|
||||
<h3>Sam Grady</h3>
|
||||
|
||||
<p>Sam Grady, me, is a graphic designer. I loves graphic design.
|
||||
Great graphic design and simple solutions makes this man very
|
||||
happy. Photography is also very close to my heart and I'd like to
|
||||
be better, so I practice a lot and annoy people with my
|
||||
requests.<br />
|
||||
<br />
|
||||
I haven't got a blog, yet, don't Twitter and cancelled my Facebook
|
||||
account as I felt uncomfortable with people knowing my business.
|
||||
Anyone else feel that way? I do, however, have a Flickr account, so
|
||||
go check it out: <a
|
||||
href="http://www.flickr.com/photos/mrgrady">www.flickr.com/photos/mrgrady</a><br />
|
||||
<br />
|
||||
I also have my own business, G72, which has a website that
|
||||
desperately needs updating. Also, as of today (03/03/09), it's
|
||||
currently down due to inept web hosts. Hopefully it won't be if you
|
||||
want to take a look: <a
|
||||
href="http://www.g-72.co.uk">www.g-72.co.uk</a><br />
|
||||
<br />
|
||||
Regarding this project, Warren asked me if I wanted to design his
|
||||
website starter package for the fantastic Umbraco CMS, which I
|
||||
jumped at the chance to do. Hopefully you'll find the design
|
||||
appropriate and the package very useful, as that's what we really
|
||||
want from this project.<br />
|
||||
<br />
|
||||
Finally, Warren says the layout is work in progress and I have a,
|
||||
typically fussy, list of designer layout requests that I've asked
|
||||
Warren to do, but time being what it is, these changes won't be
|
||||
made on version 2.0, so if you spot anything, do mail the man as
|
||||
we'll be compiling a list of tweaks to be made.<br />
|
||||
<br />
|
||||
Enjoy.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="bodyTextColOne">
|
||||
<![CDATA[
|
||||
<h3>Warren Buckley</h3>
|
||||
|
||||
<p>Warren Buckley is a web developer who specialises in using the
|
||||
Umbraco CMS platform to build content managed websites for Xeed in
|
||||
Norway. I run a blog called <a
|
||||
href="http://www.creativewebspecialist.co.uk">Creative Web
|
||||
Specialist</a>, where I mainly write tips and tutorial articles
|
||||
around Umbraco.</p>
|
||||
|
||||
<p>I have teamed up with ex-collegue Sam Grady to help me design
|
||||
the new version of CWS as he produces wonderfully sexy designs for
|
||||
the web. If you have seen my previous version/s of CWS you will
|
||||
know that my design skills are far from stunning.</p>
|
||||
|
||||
<p>I decided to create this website starter site nicknamed CWS
|
||||
(Creative Website Starter site) as a learning tool to help you
|
||||
understand how all the elements of a site work together in
|
||||
Umbraco.</p>
|
||||
|
||||
<p>From this <strong>NEW</strong> CWS package comes the
|
||||
following:</p>
|
||||
|
||||
<ul>
|
||||
<li>Obviously a <strong>BRAND NEW</strong> spanking design from
|
||||
ex-collegue Sam Grady of G-72</li>
|
||||
|
||||
<li>A focus for this site to be used to help teach new users to the
|
||||
Umbraco CMS platform.</li>
|
||||
|
||||
<li>.NET usercontrols written in C#</li>
|
||||
|
||||
<li>XSLT & .NET code heavily commented to help understand what
|
||||
is going on.</li>
|
||||
|
||||
<li>With supporting documentation coming in the near future.</li>
|
||||
</ul>
|
||||
|
||||
<p>Want to see where else you can find me on the net?<br />
|
||||
Blog - <a
|
||||
href="http://www.creativewebspecialist.co.uk">www.creativewebspecialist.co.uk</a><br />
|
||||
Flickr - <a
|
||||
href="http://www.flickr.com/photos/warrenbuckley">www.flickr.com/photos/warrenbuckley</a><br />
|
||||
Last.FM - <a
|
||||
href="http://www.last.fm/user/warrenbuckley">www.last.fm/user/warrenbuckley</a><br />
|
||||
Twitter - <a
|
||||
href="http://twitter.com/warrenbuckley">twitter.com/warrenbuckley</a></p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>This website has been produced to help you understand
|
||||
Umbraco.</p>
|
||||
]]>
|
||||
</data>
|
||||
</node>
|
||||
</node>
|
||||
<node id="1102" version="aaaee7bb-f068-4e6d-b191-4993366f1acf" parentID="1098" level="2" writerID="0" creatorID="0" nodeType="1082" template="1067" sortOrder="2" createDate="2009-02-27T09:39:54" updateDate="2009-04-07T08:31:42" nodeName="Gallery" urlName="gallery" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_GalleryList" path="-1,1098,1102">
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>This first page displays all the albums featured within your
|
||||
site.<br />
|
||||
Please have a browse through.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="sortBy"><![CDATA[sortOrder]]></data>
|
||||
<data alias="sortOrder"><![CDATA[ascending]]></data>
|
||||
<node id="1103" version="baefb3c9-1ccc-4aa9-93c4-7f5760c25932" parentID="1102" level="3" writerID="0" creatorID="0" nodeType="1083" template="1068" sortOrder="1" createDate="2009-03-02T17:58:22" updateDate="2009-04-07T08:31:48" nodeName="The Bookhouse Boys" urlName="the-bookhouse-boys" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Gallery" path="-1,1098,1102,1103">
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>The Bookhouse Boys. Live at the ICA, London.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="sortBy"><![CDATA[sortOrder]]></data>
|
||||
<data alias="sortOrder"><![CDATA[ascending]]></data>
|
||||
<data alias="galleryThumbnail">/media/1239/bookhouse-boys_gallery.jpg</data>
|
||||
<node id="1104" version="3e1ed560-41de-4d44-a6f1-5e548cc712db" parentID="1103" level="4" writerID="0" creatorID="0" nodeType="1087" template="1073" sortOrder="1" createDate="2009-03-03T18:08:55" updateDate="2009-04-07T08:31:49" nodeName="Catherine Turner and Paul Van Oestren" urlName="catherine-turner-and-paul-van-oestren" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Photo" path="-1,1098,1102,1103,1104">
|
||||
<data alias="photoText">Credit: Sam Grady</data>
|
||||
<data alias="photo">/media/1277/bookhouse-boys_3.jpg</data>
|
||||
<data alias="photoThumbnail">/media/1314/bookhouse-boys_3_thumb.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
<node id="1105" version="da6ddbfc-1a91-4701-8d94-1f96ee9d3622" parentID="1103" level="4" writerID="0" creatorID="0" nodeType="1087" template="1073" sortOrder="2" createDate="2009-03-03T18:08:19" updateDate="2009-04-07T08:31:49" nodeName="J.P.Fellows" urlName="jpfellows" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Photo" path="-1,1098,1102,1103,1105">
|
||||
<data alias="photoText">Credit: Sam Grady</data>
|
||||
<data alias="photo">/media/1250/bookhouse-boys_1.jpg</data>
|
||||
<data alias="photoThumbnail">/media/1296/bookhouse-boys_1_thumb.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
<node id="1106" version="7cd4e67f-0ff5-4703-8ce5-8a8797cd4ecc" parentID="1103" level="4" writerID="0" creatorID="0" nodeType="1087" template="1073" sortOrder="3" createDate="2009-03-03T18:08:48" updateDate="2009-04-07T08:31:50" nodeName="Catherine Turner" urlName="catherine-turner" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Photo" path="-1,1098,1102,1103,1106">
|
||||
<data alias="photoText">Credit: Sam Grady</data>
|
||||
<data alias="photo">/media/1331/bookhouse-boys_2.jpg</data>
|
||||
<data alias="photoThumbnail">/media/1350/bookhouse-boys_2_thumb.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
</node>
|
||||
<node id="1107" version="017fd898-fdbb-4afd-8e06-0bc38fbe51db" parentID="1102" level="3" writerID="0" creatorID="0" nodeType="1083" template="1068" sortOrder="2" createDate="2009-02-27T09:48:12" updateDate="2009-04-07T08:31:51" nodeName="Codegarden 08" urlName="codegarden-08" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Gallery" path="-1,1098,1102,1107">
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>Where all the great minds of umbraco meet!</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="sortBy"><![CDATA[sortOrder]]></data>
|
||||
<data alias="sortOrder"><![CDATA[ascending]]></data>
|
||||
<data alias="galleryThumbnail">/media/993/codegarden-08_gallery.jpg</data>
|
||||
<node id="1108" version="de2b19f5-b93e-48de-86a2-4e044b7926d1" parentID="1107" level="4" writerID="0" creatorID="0" nodeType="1087" template="1073" sortOrder="1" createDate="2009-03-02T15:40:01" updateDate="2009-04-07T08:31:51" nodeName="Darren and David have a chat" urlName="darren-and-david-have-a-chat" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Photo" path="-1,1098,1102,1107,1108">
|
||||
<data alias="photoText">Credit: Douglas Robar</data>
|
||||
<data alias="photo">/media/825/darren-ferguson_david-conlisk.jpg</data>
|
||||
<data alias="photoThumbnail">/media/835/darren-ferguson_david-conlisk_thumb.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
<node id="1109" version="99394045-f7cf-4bb6-a2fa-e3b11d1c3d7e" parentID="1107" level="4" writerID="0" creatorID="0" nodeType="1087" template="1073" sortOrder="2" createDate="2009-02-27T09:54:07" updateDate="2009-04-07T08:31:51" nodeName="Codegarden 08 T-Shirt" urlName="codegarden-08-t-shirt" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Photo" path="-1,1098,1102,1107,1109">
|
||||
<data alias="photoText">Credit: Warren Buckley</data>
|
||||
<data alias="photo">/media/394/codegarden08-t-shirt.jpg</data>
|
||||
<data alias="photoThumbnail">/media/799/codegarden08-t-shirt_thumb.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
<node id="1110" version="4f229339-b59e-4656-9b6e-7eab0bf94f56" parentID="1107" level="4" writerID="0" creatorID="0" nodeType="1087" template="1073" sortOrder="3" createDate="2009-03-02T15:43:43" updateDate="2009-04-07T08:31:52" nodeName="The Umbraco BINGO callers" urlName="the-umbraco-bingo-callers" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Photo" path="-1,1098,1102,1107,1110">
|
||||
<data alias="photoText">Credit: Douglas Robar</data>
|
||||
<data alias="photo">/media/852/bingo-callers.jpg</data>
|
||||
<data alias="photoThumbnail">/media/871/bingo-callers_thumb.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
<node id="1111" version="0321d7a9-0cf2-43b8-88d8-fb198db20c07" parentID="1107" level="4" writerID="0" creatorID="0" nodeType="1087" template="1073" sortOrder="4" createDate="2009-03-02T15:59:24" updateDate="2009-04-07T08:31:52" nodeName="Christian Palm chatting" urlName="christian-palm-chatting" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Photo" path="-1,1098,1102,1107,1111">
|
||||
<data alias="photoText">Credit: Douglas Robar</data>
|
||||
<data alias="photo">/media/879/christian-palm.jpg</data>
|
||||
<data alias="photoThumbnail">/media/889/christian-palm_thumb.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
</node>
|
||||
<node id="1112" version="103caccd-68ee-45f0-8943-34fc772de05e" parentID="1102" level="3" writerID="0" creatorID="0" nodeType="1083" template="1068" sortOrder="3" createDate="2009-03-02T16:02:14" updateDate="2009-04-07T08:31:53" nodeName="Bath, UK" urlName="bath,-uk" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Gallery" path="-1,1098,1102,1112">
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>Photos from a trip to Bath in November 2008</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="sortBy"><![CDATA[updateDate]]></data>
|
||||
<data alias="sortOrder"><![CDATA[ascending]]></data>
|
||||
<data alias="galleryThumbnail">/media/935/bath_gallery.jpg</data>
|
||||
<node id="1113" version="6f819ee4-7f08-4423-b4ec-2c4935edbe7b" parentID="1112" level="4" writerID="0" creatorID="0" nodeType="1087" template="1073" sortOrder="1" createDate="2009-03-02T16:27:17" updateDate="2009-04-07T08:31:54" nodeName="Royal Crescent" urlName="royal-crescent" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Photo" path="-1,1098,1102,1112,1113">
|
||||
<data alias="photoText">Credit: Warren Buckley</data>
|
||||
<data alias="photo">/media/995/royal-crescent.jpg</data>
|
||||
<data alias="photoThumbnail">/media/1014/royal-crescent_thumb.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node id="1114" version="5944cb0d-2395-4032-95bb-f93b0763ea7c" parentID="1098" level="2" writerID="0" creatorID="0" nodeType="1085" template="1071" sortOrder="3" createDate="2009-02-27T09:57:30" updateDate="2009-04-07T08:31:54" nodeName="News and Events" urlName="news-and-events" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_NewsEventsList" path="-1,1098,1114">
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="sortBy"><![CDATA[sortOrder]]></data>
|
||||
<data alias="sortOrder"><![CDATA[ascending]]></data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>Please browse through our news archive and event listings
|
||||
below.</p>
|
||||
]]>
|
||||
</data>
|
||||
<node id="1115" version="515b40e0-cc1a-4342-a285-a407cabc9546" parentID="1114" level="3" writerID="0" creatorID="0" nodeType="1081" template="1066" sortOrder="1" createDate="2009-02-27T10:00:53" updateDate="2009-04-07T08:31:54" nodeName="Codegarden 09" urlName="codegarden-09" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_EventItem" path="-1,1098,1114,1115">
|
||||
<data alias="eventDate">2009-06-22T00:00:00</data>
|
||||
<data alias="bodyText">
|
||||
<![CDATA[
|
||||
<h3>Come join the annual umbraco developer conference in Wonderful
|
||||
Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers,
|
||||
great conversations and friendly people.</h3>
|
||||
|
||||
<p>The who's who of umbraco will be gathered and share their
|
||||
knowledge through talks, tutorials and via un-conference formats
|
||||
like open space or hacking sessions. We have booked a cool, old and
|
||||
huge industrial venue in central Copenhagen where we'll have one
|
||||
huge room, three rooms for breakout sessions and a Café that
|
||||
serves your taste of espresso.</p>
|
||||
|
||||
<p>Come join the annual umbraco developer conference in Wonderful
|
||||
Copenhagen on June 22nd - 23rd. Two days for insights, eye-openers,
|
||||
great conversations and friendly people.</p>
|
||||
|
||||
<p>We've planned a program that fits both experienced umbraco users
|
||||
as well as new comers. The conference is kicked off with a Keynote
|
||||
and after that we'll have two or three tracks of sessions and the
|
||||
first day is rounded with an open Q/A session with the umbraco core
|
||||
team.</p>
|
||||
|
||||
<p>The second day features an un-conference format called open
|
||||
space, which we also used with great success at last year's
|
||||
conference. It's a format where everybody can suggest a topic and
|
||||
as we have plenty of break-out rooms rest assured that there'll be
|
||||
room for your topic as well. Last year's more than 20 topics
|
||||
covered Silverlight, High performance websites with umbraco,
|
||||
building custom data types and much more.</p>
|
||||
|
||||
<p>But it doesn't ends there. We've ensured that we can stay at the
|
||||
venue until midnight both days which means that when the first day
|
||||
ends, the fun begins. With more than hundred people gathered at a
|
||||
place with loads of umbraco knowledge, wifi, great food and plenty
|
||||
of space, who knows what could happen. A BBQ, new packages,
|
||||
improvised demos and talks, or...?</p>
|
||||
|
||||
<p> </p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="articlePhoto">/media/445/umbraco_tshirt.jpg</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
<node id="1116" version="00a7fcd7-5a5b-4b50-97f5-6fad5261b6cd" parentID="1114" level="3" writerID="0" creatorID="0" nodeType="1086" template="1072" sortOrder="2" createDate="2009-03-02T16:32:06" updateDate="2009-04-07T08:31:55" nodeName="CWS2 is released" urlName="cws2-is-released" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_NewsItem" path="-1,1098,1114,1116">
|
||||
<data alias="bodyText">
|
||||
<![CDATA[
|
||||
<h3>After Warren Buckley's success of the first Creative Website
|
||||
Starter site package, with over 20K downloads he has decided to
|
||||
work on CWS2.</h3>
|
||||
|
||||
<p>As of today Wednesday the 4th March 2009, the CWS2 package is
|
||||
now available to download from the built in package repository
|
||||
inside Umbraco.</p>
|
||||
|
||||
<p>With this new version comes the following:</p>
|
||||
|
||||
<ul>
|
||||
<li>A <strong>BRAND NEW</strong> spanking design from ex-collegue
|
||||
<a href="http://www.g-72.co.uk"
|
||||
title="Designer Sam Grady of G72">Sam Grady of G-72</a></li>
|
||||
|
||||
<li>A focus for this site to be used to help teach new users to the
|
||||
Umbraco CMS platform.</li>
|
||||
|
||||
<li>.NET usercontrols written in C#</li>
|
||||
|
||||
<li>XSLT & .NET code heavily commented to help understand what
|
||||
is going on.</li>
|
||||
|
||||
<li>With supporting documentation coming in the near future.</li>
|
||||
</ul>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="articlePhoto">
|
||||
</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
</node>
|
||||
</node>
|
||||
<node id="1117" version="e29fb4b9-3a29-46a0-9c82-bdc3e297cfc5" parentID="1098" level="2" writerID="0" creatorID="0" nodeType="1079" template="1064" sortOrder="4" createDate="2009-02-27T10:03:12" updateDate="2009-04-07T08:31:55" nodeName="Contact" urlName="contact" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_Contact" path="-1,1098,1117">
|
||||
<data alias="emailTo">you@yourcompany.co.uk</data>
|
||||
<data alias="emailSubject">Email from Contact form on website</data>
|
||||
<data alias="emailBody">
|
||||
<![CDATA[Hello a user of your site has filled in your contact form on [Date] @ [Time]
|
||||
|
||||
Name: [Name]
|
||||
Address: [AddressLine1], [AddressLine2]
|
||||
Email: [Email]
|
||||
Message: [Message]]]>
|
||||
</data>
|
||||
<data alias="emailReplyFrom">you@yourcompany.co.uk</data>
|
||||
<data alias="emailReplySubject">Thank you for your message</data>
|
||||
<data alias="emailReplyBody">
|
||||
<![CDATA[Hello [Name]
|
||||
Thanks for contacting us, we will reply shortly.
|
||||
|
||||
Your Company Name
|
||||
www.yourcompany.co.uk]]>
|
||||
</data>
|
||||
<data alias="enableSSL">0</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">0</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>Everything you need to<br />
|
||||
get in touch.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="formText">
|
||||
<![CDATA[
|
||||
<h3>Enquiry Form</h3>
|
||||
|
||||
<p>If you have a particular enquiry, please fill out the form below
|
||||
and provide as much information as you can, so that one of our
|
||||
representatives can deal with your enquiry as effciently as
|
||||
possible.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="thankYouHeaderText">
|
||||
<![CDATA[
|
||||
<p><strong>Thank you.</strong> We will be in touch shortly.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="thankYouMessageText">
|
||||
<![CDATA[
|
||||
<p>Thanks for filling out our contact form we will get back to you
|
||||
shortly.</p>
|
||||
|
||||
<p>Regards,<br />
|
||||
My Company</p>
|
||||
]]>
|
||||
</data>
|
||||
</node>
|
||||
<node id="1118" version="f0ac3795-d7bf-4869-a147-4def5358ed26" parentID="1098" level="2" writerID="0" creatorID="0" nodeType="1080" template="1065" sortOrder="5" createDate="2009-02-27T10:05:57" updateDate="2009-04-07T08:31:56" nodeName="Email a Friend" urlName="email-a-friend" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="CWS_EmailAFriend" path="-1,1098,1118">
|
||||
<data alias="emailFrom">you@yourcompany.co.uk</data>
|
||||
<data alias="emailSubjectToFriend">[YourName] has sent you a link to read</data>
|
||||
<data alias="emailMessageToFriend">
|
||||
<![CDATA[Hello [FriendName], [YourName] has sent you this link to read.
|
||||
|
||||
URL: [URL]
|
||||
Message: [Message]
|
||||
|
||||
--------------------------------------------------------
|
||||
Your Company Name
|
||||
www.yourcompany.co.uk]]>
|
||||
</data>
|
||||
<data alias="enableSSL">0</data>
|
||||
<data alias="umbracoUrlName">
|
||||
</data>
|
||||
<data alias="umbracoUrlAlias">
|
||||
</data>
|
||||
<data alias="metaDescription"><![CDATA[]]></data>
|
||||
<data alias="metaKeywords"><![CDATA[]]></data>
|
||||
<data alias="umbracoRedirect">0</data>
|
||||
<data alias="umbracoNaviHide">1</data>
|
||||
<data alias="headerText">
|
||||
<![CDATA[
|
||||
<p>Send a page onto your friend.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="thankYouHeaderText">
|
||||
<![CDATA[
|
||||
<p><strong>Thank you.</strong> We appreciate the love you are
|
||||
giving our site.</p>
|
||||
]]>
|
||||
</data>
|
||||
<data alias="thankYouMessageText">
|
||||
<![CDATA[
|
||||
<p>Thanks for sending that link onto your friend, we really
|
||||
appreciate it here at My Company.</p>
|
||||
]]>
|
||||
</data>
|
||||
</node>
|
||||
</node>
|
||||
</root>
|
||||
@@ -0,0 +1,83 @@
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{324A7FA9-8F19-4D4D-B96A-6F673C82BC92}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>umbraco.LinqCore.Mockable.Tests</RootNamespace>
|
||||
<AssemblyName>umbraco.LinqCore.Mockable.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug - Fixed Version|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug - Fixed Version\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="Rhino.Mocks, Version=3.5.0.1337, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dep\Reference Assemblies\Mocking\Rhino.Mocks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Solution Items\SolutionInfo.cs">
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="DataContextMockTest.cs" />
|
||||
<Compile Include="MyUmbraco.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Core\Core.csproj">
|
||||
<Project>{31CAEC36-0C3D-4D69-B092-84866811EA07}</Project>
|
||||
<Name>Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Rhino.Mocks;
|
||||
using umbraco.Linq.Core;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.LinqCore.Mockable.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for DataContextMockTest
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class DataContextMockTest
|
||||
{
|
||||
public DataContextMockTest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod]
|
||||
public void DataContextMockTest_MockProvider()
|
||||
{
|
||||
var dataProvider = MockRepository.GenerateMock<umbracoDataProvider>();
|
||||
using (var ctx = new MyumbracoDataContext(dataProvider))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, ExpectedException(typeof(NotImplementedException))]
|
||||
public void DataContextMockTest_MockProviderThrowsException()
|
||||
{
|
||||
var dataProvider = MockRepository.GenerateMock<umbracoDataProvider>();
|
||||
|
||||
dataProvider.Stub(d => d.LoadTree<CwsHome>()).Throw(new NotImplementedException());
|
||||
using (var ctx = new MyumbracoDataContext(dataProvider))
|
||||
{
|
||||
var homes = ctx.CwsHomes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
using System.Reflection;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Core")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("Core")]
|
||||
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for AncestorTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class AncestorTest
|
||||
{
|
||||
public AncestorTest()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void AncestorTest_NoWhereCondition_Exists()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var textPage = ctx.CwsTextpages.First();
|
||||
|
||||
var hp = textPage.AncestorOrDefault<CwsHome>();
|
||||
|
||||
Assert.IsNotNull(hp);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void AncestorTest_NoWhereCondition_NotExists()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var textPage = ctx.CwsTextpages.First();
|
||||
|
||||
var a = textPage.AncestorOrDefault<CwsPhoto>();
|
||||
|
||||
Assert.IsNull(a);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void AncestorTest_Where_Exists()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var photo = ctx.CwsPhotos.First(p => p.Name.Contains("umbraco"));
|
||||
var gallery = photo.AncestorOrDefault<CwsGallery>(g => g.Name.Contains("Codegarden"));
|
||||
|
||||
Assert.IsNotNull(gallery);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void AncestorTest_Where_NotExists()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var photo = ctx.CwsPhotos.First(p => p.Name.Contains("umbraco"));
|
||||
var gallery = photo.AncestorOrDefault<CwsGallery>(g => g.Name.Contains("Bookhouses"));
|
||||
|
||||
Assert.IsNull(gallery);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="umbracoPath" value="umbraco.config"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -0,0 +1,136 @@
|
||||
==========================================================================
|
||||
Visual Studio Team System: Overview of Authoring and Running Tests
|
||||
==========================================================================
|
||||
|
||||
This overview describes the features for authoring and running tests in
|
||||
Visual Studio Team System and Visual Studio Team Edition for Software Testers.
|
||||
|
||||
Opening Tests
|
||||
-------------
|
||||
To open a test, open a test project or a test metadata file (a file with
|
||||
extension .vsmdi) that contains the definition of the test. You can find
|
||||
test projects and metadata files in Solution Explorer.
|
||||
|
||||
Viewing Tests
|
||||
-------------
|
||||
To see which tests are available to you, open the Test View window. Or,
|
||||
if you have installed Team Edition for Software Testers, you can also open
|
||||
the Test List Editor window to view tests.
|
||||
|
||||
To open the Test View window, click the Test menu, point to Windows, and
|
||||
then click Test View. To open the Test List Editor window (if you have
|
||||
installed Team Edition for Software Testers), click Test, point to Windows,
|
||||
and then click Test List Editor.
|
||||
|
||||
Running Tests
|
||||
-------------
|
||||
You can run tests from the Test View window and the Test List Editor window.
|
||||
See Viewing Tests to learn how to open these windows. To run one or more
|
||||
tests displayed in the Test View window, first select the tests in that
|
||||
window; to select multiple tests, hold either the Shift or CTRL key while
|
||||
clicking tests. Then click the Run Tests button in the Test View window
|
||||
toolbar.
|
||||
|
||||
If you have installed Visual Studio Team Edition for Software Testers, you can
|
||||
also use the Test List Editor window to run tests. To run tests in Test List Editor,
|
||||
select the check box next to each test that you want to run. Then click the
|
||||
Run Tests button in the Test List Editor window toolbar.
|
||||
|
||||
Viewing Test Results
|
||||
--------------------
|
||||
When you run a test or a series of tests, the results of the test run will be
|
||||
shown in the Test Results window. Each individual test in the run is shown on
|
||||
a separate line so that you can see its status. The window contains an
|
||||
embedded status bar in the top half of the window that provides you with
|
||||
summary details of the complete test run.
|
||||
|
||||
To see more detailed results for a particular test result, double-click it in
|
||||
the Test Results window. This opens a window that provides more information
|
||||
about the particular test result, such as any specific error messages returned
|
||||
by the test.
|
||||
|
||||
Changing the way that tests are run
|
||||
-----------------------------------
|
||||
Each time you run one or more tests, a collection of settings is used to
|
||||
determine how those tests are run. These settings are contained in a “test
|
||||
run configuration” file.
|
||||
|
||||
Here is a partial list of the changes you can make with a test run
|
||||
configuration file:
|
||||
|
||||
- Change the naming scheme for each test run.
|
||||
- Change the test controller that the tests are run on so that you can run
|
||||
tests remotely.
|
||||
- Gather code coverage data for the code being tested so that you can see
|
||||
which lines of code are covered by your tests.
|
||||
- Enable and disable test deployment.
|
||||
- Specify additional files to deploy before tests are run.
|
||||
- Select a different host, ASP.NET, for running ASP.NET unit tests.
|
||||
- Select a different host, the smart device test host, for running smart device unit tests.
|
||||
- Set various properties for the test agents that run your tests.
|
||||
- Run custom scripts at the start and end of each test run so that you can
|
||||
set up the test environment exactly as required each time tests are run.
|
||||
- Set time limits for tests and test runs.
|
||||
- Set the browser mix and the number of times to repeat Web tests in the
|
||||
test run.
|
||||
|
||||
By default, a test run configuration file is created whenever you create a
|
||||
new test project. You make changes to this file by double-clicking it in
|
||||
Solution Explorer and then changing its settings. (Test run configuration
|
||||
files have the extension .testrunconfig.)
|
||||
|
||||
A solution can contain multiple test run configuration files. Only one of
|
||||
those files, known as the “Active” test run configuration file, is used to
|
||||
determine the settings that are currently used for test runs. You select
|
||||
the active test run configuration by clicking Select Active Test Run
|
||||
Configuration on the Test menu.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Test Types
|
||||
----------
|
||||
Using Visual Studio Team Edition for Software Testers, you can create a number
|
||||
of different test types:
|
||||
|
||||
Unit test: Use a unit test to create a programmatic test in C++, Visual C# or
|
||||
Visual Basic that exercises source code. A unit test calls the methods of a
|
||||
class, passing suitable parameters, and verifies that the returned value is
|
||||
what you expect.
|
||||
There are three specialized variants of unit tests:
|
||||
- Data-driven unit tests are created when you configure a unit test to be
|
||||
called repeatedly for each row of a data source. The data from each row
|
||||
is used by the unit test as input data.
|
||||
- ASP.NET unit tests are unit tests that exercise code in an ASP.NET Web
|
||||
application.
|
||||
- Smart device unit tests are unit tests that are deployed to a smart device
|
||||
or emulator and then executed by the smart device test host.
|
||||
|
||||
Web Test: Web tests consist of an ordered series of HTTP requests that you
|
||||
record in a browser session using Microsoft Internet Explorer. You can have
|
||||
the test report specific details about the pages or sites it requests, such
|
||||
as whether a particular page contains a specified string.
|
||||
|
||||
Load Test: You use a load test to encapsulate non-manual tests, such as
|
||||
unit, Web, and generic tests, and then run them simultaneously by using
|
||||
virtual users. Running these tests under load generates test results,
|
||||
including performance and other counters, in tables and in graphs.
|
||||
|
||||
Generic test: A generic test is an existing program wrapped to function as a
|
||||
test in Visual Studio. The following are examples of tests or programs that
|
||||
you can turn into generic tests:
|
||||
- An existing test that uses process exit codes to communicate whether the
|
||||
test passed or failed. 0 indicates passing and any other value indicates
|
||||
a failure.
|
||||
- A general program to obtain specific functionality during a test scenario.
|
||||
- A test or program that uses a special XML file (called a “summary results
|
||||
file”), to communicate detailed results.
|
||||
|
||||
Manual test: The manual test type is used when the test tasks are to be
|
||||
completed by a test engineer as opposed to an automated script.
|
||||
|
||||
Ordered test: Use an ordered test to execute a set of tests in an order you
|
||||
specify.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for CacheTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class CacheTest
|
||||
{
|
||||
public CacheTest()
|
||||
{
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void CacheTest_ForcedRefresh()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var hps = ctx.CwsHomes;
|
||||
|
||||
ctx.CwsHomes.ReloadCache();
|
||||
|
||||
var reloadedHps = ctx.CwsHomes;
|
||||
|
||||
Assert.AreNotSame(reloadedHps, hps, "Force reload should result in a different object");
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void CacheTest_RequeryLoadFromCache()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var hps = ctx.CwsHomes;
|
||||
|
||||
var requeriedHps = ctx.CwsHomes;
|
||||
|
||||
Assert.AreSame(requeriedHps, hps, "Requeried objects should result in the same collection");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ChildTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class ChildTest
|
||||
{
|
||||
public ChildTest()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void ChildTest_ChildExist()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var pages = ctx.CwsHomes.First().CwsTextpages;
|
||||
|
||||
Assert.AreNotEqual(0, pages.Count());
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void ChildTest_ChildToParent()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var page = ctx.CwsHomes.First().CwsTextpages.First();
|
||||
|
||||
Assert.AreEqual(ctx.CwsHomes.First().Id, page.Parent<CwsHome>().Id);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void ChildTest_AllChildren()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var hp = ctx.CwsHomes.First();
|
||||
|
||||
Assert.IsTrue(hp.Children.Count() > 0);
|
||||
Assert.IsInstanceOfType(hp.Children.First(), typeof(CwsTextpage));
|
||||
Assert.IsInstanceOfType(hp.Children.Skip(1).First(), typeof(CwsGallerylist));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{A80528D0-E68C-4A94-9489-C712216665B0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>umbraco.Linq.Core.Tests</RootNamespace>
|
||||
<AssemblyName>umbraco.Linq.Core.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug - Fixed Version|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug - Fixed Version\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="businesslogic, Version=1.0.3317.17186, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dep\Reference Assemblies\Umbraco\businesslogic.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="TypeMock, Version=5.3.0.0, Culture=neutral, PublicKeyToken=3dae460033b8d8e2, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dep\Reference Assemblies\Mocking\TypeMock.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Typemock.ArrangeActAssert, Version=5.3.0.0, Culture=neutral, PublicKeyToken=3dae460033b8d8e2, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dep\Reference Assemblies\Mocking\Typemock.ArrangeActAssert.Dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="umbraco, Version=1.0.3317.32692, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dep\Reference Assemblies\Umbraco\umbraco.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="umbraco.DataLayer, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\dep\Reference Assemblies\Umbraco\umbraco.DataLayer.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Solution Items\SolutionInfo.cs">
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AncestorTest.cs" />
|
||||
<Compile Include="CacheTest.cs" />
|
||||
<Compile Include="ChildTest.cs" />
|
||||
<Compile Include="CwsReplicationTest.cs" />
|
||||
<Compile Include="DataContextTest.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="InheritanceTest.cs" />
|
||||
<Compile Include="MockHelpers.cs" />
|
||||
<Compile Include="MyUmbraco.designer.cs" />
|
||||
<Compile Include="OrderingTest.cs" />
|
||||
<Compile Include="ParentTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SelectTest.cs" />
|
||||
<Compile Include="WhereTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="AuthoringTests.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Core\Core.csproj">
|
||||
<Project>{31CAEC36-0C3D-4D69-B092-84866811EA07}</Project>
|
||||
<Name>Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\..\dep\Test Helpers\umbraco.config">
|
||||
<Link>umbraco.config</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests to replicate the functionality of the CWS2 xslt's
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class CwsReplicationTest
|
||||
{
|
||||
public CwsReplicationTest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void CwsReplicationTest_ListGalleries()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var galleryList = ctx.CwsGallerylists.First(); //this would really be a Where(g => g.Id == umbracoContext.Current.PageId.Value) but since I'm not really on a page...
|
||||
|
||||
var galleries = from g in galleryList.CwsGalleries
|
||||
where g.CwsPhotos.Count() >= 1
|
||||
orderby g.Name
|
||||
select new
|
||||
{
|
||||
g.Name,
|
||||
Url = umbraco.library.NiceUrl(g.Id),
|
||||
Thumbnail = (string.IsNullOrEmpty(g.Gallerythumbnail) ? "/Assets/Placeholders/gallery_placeholder.gif" : g.Gallerythumbnail),
|
||||
PhotoCount = g.CwsPhotos.Count(),
|
||||
};
|
||||
|
||||
Assert.AreEqual(3, galleries.Count());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Linq.Core.Node;
|
||||
using umbraco.Test;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for DataContextTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class DataContextTest
|
||||
{
|
||||
public DataContextTest()
|
||||
{
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, ExpectedException(typeof(ArgumentNullException))]
|
||||
public void DataContextTest_FileNameRequired()
|
||||
{
|
||||
var nodeProvider = new NodeDataProvider(string.Empty);
|
||||
}
|
||||
|
||||
[TestMethod, ExpectedException(typeof(FileNotFoundException))]
|
||||
public void DataContextTest_FileMustExist()
|
||||
{
|
||||
var nodeProvider = new NodeDataProvider(@"C:\fakeFile.config");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DataContextTest_ConstructFromExistingProvider()
|
||||
{
|
||||
var nodeProvider = new NodeDataProvider(Path.Combine(Environment.CurrentDirectory, "umbraco.config"));
|
||||
|
||||
MyumbracoDataContext ctx = new MyumbracoDataContext(nodeProvider);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DataContextTest_EnsureSchemaValidation()
|
||||
{
|
||||
var nodeProvider = new NodeDataProvider(Path.Combine(Environment.CurrentDirectory, "umbraco.config"), true);
|
||||
|
||||
MyumbracoDataContext ctx = new MyumbracoDataContext(nodeProvider);
|
||||
|
||||
var hp = ctx.CwsHomes.First();
|
||||
|
||||
Assert.IsNotNull(hp);
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void DataContextTest_DefaultConstructorIsNodeProvider()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
var ctx = new MyumbracoDataContext();
|
||||
|
||||
Assert.IsInstanceOfType(ctx.DataProvider, typeof(NodeDataProvider));
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void DataContextTest_NodeCached()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var hp = ctx.CwsHomes.First();
|
||||
var hp2 = ctx.CwsHomes.First();
|
||||
|
||||
Assert.AreSame(hp, hp2);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void DataContextTest_FullCache()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var one = ctx.CwsHomes;
|
||||
var two = ctx.CwsHomes;
|
||||
|
||||
Assert.AreSame(one, two);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void DataContextTest_OfNodeTypes()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var tree = ctx.CwsHomes;
|
||||
|
||||
Assert.IsInstanceOfType(tree, typeof(NodeTree<CwsHome>));
|
||||
Assert.IsInstanceOfType(tree.First().CwsTextpages, typeof(NodeAssociationTree<CwsTextpage>));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static ActionRepeater<TReturn> WillReturnRepeat<TReturn>(this IPublicNonVoidMethodHandler<TReturn> ret, TReturn value, int numberOfReturns)
|
||||
{
|
||||
for (var i = 0; i < numberOfReturns; i++)
|
||||
ret.WillReturn(value);
|
||||
|
||||
return new ActionRepeater<TReturn>(ret);
|
||||
}
|
||||
|
||||
public static ActionRepeater<TReturn> CallOriginalRepeat<TReturn>(this IPublicNonVoidMethodHandler<TReturn> ret, int numberOfReturns)
|
||||
{
|
||||
for (var i = 0; i < numberOfReturns; i++)
|
||||
ret.CallOriginal();
|
||||
|
||||
return new ActionRepeater<TReturn>(ret);
|
||||
}
|
||||
}
|
||||
|
||||
public class ActionRepeater<TReturn>
|
||||
{
|
||||
private IPublicNonVoidMethodHandler<TReturn> _actionRepeater;
|
||||
public ActionRepeater(IPublicNonVoidMethodHandler<TReturn> actionRepeater)
|
||||
{
|
||||
_actionRepeater = actionRepeater;
|
||||
}
|
||||
|
||||
public IPublicNonVoidMethodHandler<TReturn> AndThen()
|
||||
{
|
||||
return _actionRepeater;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for InheritanceTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class InheritanceTest
|
||||
{
|
||||
public InheritanceTest()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod]
|
||||
public void InheritanceTest_ImplementsBaseClass()
|
||||
{
|
||||
var tmp = new TextpageThreeCol();
|
||||
|
||||
Assert.AreEqual(typeof(CwsTextpagetwocol), tmp.GetType().BaseType);
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void InheritanceTest_PropertyFromBase()
|
||||
{
|
||||
var fake = Isolate.Fake.Instance<TextpageThreeCol>();
|
||||
|
||||
Assert.AreEqual(typeof(CwsTextpagetwocol), fake.GetType().GetProperties().Single(p => p.Name == "Headertext").DeclaringType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using System.IO;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
internal class MockHelpers
|
||||
{
|
||||
public static void SetupFakeHttpContext()
|
||||
{
|
||||
HttpContext fakeHttpContext = Isolate.Fake.Instance<HttpContext>(Members.MustSpecifyReturnValues);
|
||||
HttpServerUtility fakeServer = Isolate.Fake.Instance<HttpServerUtility>();
|
||||
Isolate.WhenCalled(() => HttpContext.Current).WillReturn(fakeHttpContext);
|
||||
Isolate.WhenCalled(() => fakeHttpContext.Server).WillReturn(fakeServer);
|
||||
Isolate.WhenCalled(() => fakeServer.MapPath(string.Empty)).WillReturn(Path.Combine(Environment.CurrentDirectory, "umbraco.config"));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for OrderingTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class OrderingTest
|
||||
{
|
||||
public OrderingTest()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void OrderingTest_Date()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var orderedContext = new MyumbracoDataContext())
|
||||
{
|
||||
var asc = orderedContext.CwsTextpages.OrderBy(p => p.CreateDate);
|
||||
|
||||
var desc = orderedContext.CwsTextpages.OrderByDescending(p => p.CreateDate);
|
||||
|
||||
Assert.AreEqual(asc.Count(), desc.Count());
|
||||
Assert.AreNotEqual(asc.First().Id, desc.First().Id);
|
||||
Assert.AreEqual(asc.First().Id, desc.Last().Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ParentTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class ParentTest
|
||||
{
|
||||
public ParentTest()
|
||||
{
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void ParentTest_ParentIdExists()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var p = ctx.CwsTextpages.First();
|
||||
Assert.AreNotEqual(0, p.ParentNodeId);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void ParentTest_ParentCreated()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var page = ctx.CwsTextpages.Single(p => p.Id == 1099);
|
||||
|
||||
Assert.AreEqual(1098, page.ParentNodeId);
|
||||
|
||||
var parent = page.Parent<CwsHome>();
|
||||
|
||||
Assert.AreEqual(page.ParentNodeId, parent.Id);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void ParentTest_TopParentNull()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var hp = ctx.CwsHomes.First();
|
||||
Assert.IsNull(hp.Parent<CwsHome>());
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated, ExpectedException(typeof(DocTypeMissMatchException))]
|
||||
public void ParentTest_InvalidParentType()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var p = ctx.CwsPhotos.First().Parent<CwsHome>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Reflection;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Core")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("Core")]
|
||||
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using umbraco.Test;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for SelectTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class SelectTest
|
||||
{
|
||||
public SelectTest()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void SelectTest_LoopTree_Query()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var homePages = from hp in ctx.CwsHomes
|
||||
select hp;
|
||||
|
||||
Assert.IsNotNull(homePages);
|
||||
foreach (var item in homePages)
|
||||
{
|
||||
Assert.IsTrue(item.Bodytext.Length > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void SelectTest_LoopTree_Lambda()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var homePages = ctx.CwsHomes;
|
||||
|
||||
Assert.IsNotNull(homePages);
|
||||
foreach (CwsHome item in homePages)
|
||||
{
|
||||
Assert.IsTrue(item.Bodytext.Length > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void SelectTest_SingleProperty_Query()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var homePageText = from hp in ctx.CwsHomes
|
||||
select hp.Bodytext;
|
||||
|
||||
Assert.IsNotNull(homePageText);
|
||||
foreach (var item in homePageText)
|
||||
{
|
||||
Assert.IsNotNull(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void SelectTest_SingleProperty_Lambda()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var homePageText = ctx.CwsHomes.Select(hp => hp.Bodytext);
|
||||
|
||||
Assert.IsNotNull(homePageText);
|
||||
foreach (var item in homePageText)
|
||||
{
|
||||
Assert.IsNotNull(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void SelectTest_Anonymous_Query()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var anon = from hp in ctx.CwsHomes
|
||||
select new
|
||||
{
|
||||
hp.Bodytext,
|
||||
CreatedDate = hp.CreateDate
|
||||
};
|
||||
|
||||
Assert.IsNotNull(anon);
|
||||
foreach (var item in anon)
|
||||
{
|
||||
Assert.IsNotNull(item.Bodytext);
|
||||
Assert.AreNotEqual(DateTime.MinValue, item.CreatedDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void SelectTest_Anonymous_Lambda()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var anon = ctx.CwsHomes.Select(hp => new
|
||||
{
|
||||
hp.Bodytext,
|
||||
CreatedDate = hp.CreateDate
|
||||
});
|
||||
|
||||
Assert.IsNotNull(anon);
|
||||
foreach (var item in anon)
|
||||
{
|
||||
Assert.IsNotNull(item.Bodytext);
|
||||
Assert.AreNotEqual(DateTime.MinValue, item.CreatedDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TypeMock.ArrangeActAssert;
|
||||
using umbraco.Test;
|
||||
|
||||
namespace umbraco.Linq.Core.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for WhereTest
|
||||
/// </summary>
|
||||
[TestClass, DeploymentItem("umbraco.config")]
|
||||
public class WhereTest
|
||||
{
|
||||
public WhereTest()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
// You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
// Use ClassInitialize to run code before running the first test in the class
|
||||
// [ClassInitialize()]
|
||||
// public static void MyClassInitialize(TestContext testContext) { }
|
||||
//
|
||||
// Use ClassCleanup to run code after all tests in a class have run
|
||||
// [ClassCleanup()]
|
||||
// public static void MyClassCleanup() { }
|
||||
//
|
||||
// Use TestInitialize to run code before running each test
|
||||
// [TestInitialize()]
|
||||
// public void MyTestInitialize() { }
|
||||
//
|
||||
// Use TestCleanup to run code after each test has run
|
||||
// [TestCleanup()]
|
||||
// public void MyTestCleanup() { }
|
||||
//
|
||||
#endregion
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void WhereTest_SingleParameter_Query()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var pages = from page in ctx.CwsTextpages
|
||||
where page.Bodytext.Length > 0
|
||||
select page;
|
||||
|
||||
Assert.IsNotNull(pages);
|
||||
Assert.IsTrue(pages.Count() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void WhereTest_DateTimeGreaterThan_Query()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var pages = from page in ctx.CwsTextpages
|
||||
where page.CreateDate > DateTime.MinValue
|
||||
select page;
|
||||
|
||||
Assert.IsNotNull(pages);
|
||||
Assert.IsTrue(pages.Count() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void WhereTest_TwoParameter_Query()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var pages = from page in ctx.CwsTextpages
|
||||
where page.Bodytext.Length > 0
|
||||
&& page.CreateDate > DateTime.MinValue
|
||||
select page;
|
||||
|
||||
Assert.IsNotNull(pages);
|
||||
Assert.IsTrue(pages.Count() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod, Isolated]
|
||||
public void WhereTest_ToAnonymous()
|
||||
{
|
||||
MockHelpers.SetupFakeHttpContext();
|
||||
using (var ctx = new MyumbracoDataContext())
|
||||
{
|
||||
var pages = from page in ctx.CwsTextpages
|
||||
where page.Bodytext.Length > 0
|
||||
select new
|
||||
{
|
||||
page.Id,
|
||||
page.Bodytext
|
||||
};
|
||||
|
||||
Assert.AreNotEqual(0, pages.Count());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the child items of TDocTypeBase
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is used for creating a DataProvider specific child item collection of a DocType instance.
|
||||
///
|
||||
/// It allows a DocType to have strongly typed child associations, and accessors such as:
|
||||
/// <example>
|
||||
/// myDocType.SomeChildTypes
|
||||
/// </example>
|
||||
/// </remarks>
|
||||
/// <typeparam name="TDocTypeBase">The type of the DocTypeBase which this association represents.</typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
|
||||
public abstract class AssociationTree<TDocTypeBase> : Tree<TDocTypeBase> where TDocTypeBase : DocTypeBase, new()
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the parent node id which this AssociationTree is for
|
||||
/// </summary>
|
||||
/// <value>The parent node id.</value>
|
||||
public int ParentNodeId { get; protected set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Standard umbraco info
|
||||
/// </summary>
|
||||
[global::System.AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
|
||||
public sealed class UmbracoInfoAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="umbracoInfoAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="alias">The alias for this piece of umbraco info.</param>
|
||||
public UmbracoInfoAttribute(string alias)
|
||||
{
|
||||
this.Alias = alias;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display name of the item.
|
||||
/// </summary>
|
||||
/// <value>The display name.</value>
|
||||
public string DisplayName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the alias.
|
||||
/// </summary>
|
||||
/// <value>The alias.</value>
|
||||
public string Alias { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this property is mandatory.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if mandatory; otherwise, <c>false</c>.</value>
|
||||
public bool Mandatory { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the DocumentTypeId
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks a class as an umbraco DocType
|
||||
/// </summary>
|
||||
[global::System.AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
|
||||
public sealed class DocTypeAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocTypeAttribute"/> class.
|
||||
/// </summary>
|
||||
public DocTypeAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks a property as a standard umbraco field
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Example usage:
|
||||
/// - ID
|
||||
/// - ParentID
|
||||
/// - CreateDate
|
||||
/// </remarks>
|
||||
[global::System.AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
|
||||
public sealed class FieldAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FieldAttribute"/> class.
|
||||
/// </summary>
|
||||
public FieldAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks a property as a custom umbraco DocType property
|
||||
/// </summary>
|
||||
[global::System.AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
|
||||
public sealed class PropertyAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PropertyAttribute"/> class.
|
||||
/// </summary>
|
||||
public PropertyAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1" GroupingSetting="Access" MembersFormat="NameAndType">
|
||||
<Class Name="umbraco.Linq.Core.AssociationTree<TDocTypeBase>">
|
||||
<Position X="1" Y="4.75" Width="2.25" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAA=</HashCode>
|
||||
<FileName>AssociationTree.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.Core.DocTypeBase" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="10.75" Y="0.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>MAASJAACAQCEAAAgAACUYQQBgACAAAAgEAIBAAEEAYI=</HashCode>
|
||||
<FileName>DocTypeBase.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.Core.Tree<TDocType>">
|
||||
<Position X="2.5" Y="0.75" Width="3" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAACAAAAAAAEABAQAAAAAAAAABAAAAAEAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Tree.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.Core.umbracoDataContext" Collapsed="true" BaseTypeListCollapsed="true">
|
||||
<Position X="12.5" Y="0.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAACAEAAAAAAAAAABAAAAAAAAAAAAACACAAAA=</HashCode>
|
||||
<FileName>umbracoDataContext.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" Collapsed="true" />
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.Core.Node.NodeAssociationTree<TDocTypeBase>">
|
||||
<Position X="0.5" Y="6.75" Width="3.25" />
|
||||
<Compartments>
|
||||
<Compartment Name="Private" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAABAAAAAAABAQAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Node\NodeAssociationTree.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.Core.Node.NodeDataProvider" BaseTypeListCollapsed="true">
|
||||
<Position X="5.25" Y="12" Width="4.5" />
|
||||
<Compartments>
|
||||
<Compartment Name="Private" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAiAAAACAEAAQAAAABCKQAAAAAAAAAAAACCAiAAAA=</HashCode>
|
||||
<FileName>Node\NodeDataProvider.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.Core.Node.NodeTree<TDocTypeBase>">
|
||||
<Position X="4.5" Y="4.75" Width="3.25" />
|
||||
<Compartments>
|
||||
<Compartment Name="Private" Collapsed="true" />
|
||||
</Compartments>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAACABAAAAAAABAQAAAAAAAAABAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>Node\NodeTree.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.Core.umbracoDataProvider">
|
||||
<Position X="5.25" Y="8.75" Width="4.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAgAAAACAAAAQAAAABAAQAAAAAAAAAAAAAAACAAAA=</HashCode>
|
||||
<FileName>umbracoDataProvider.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Interface Name="umbraco.Linq.Core.ITree" Collapsed="true">
|
||||
<Position X="10.75" Y="2" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAEAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>ITree.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Font Name="Segoe UI" Size="9" />
|
||||
</ClassDiagram>
|
||||
@@ -0,0 +1,367 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Xml.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the base framework for an umbraco item
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class DocTypeBase : INotifyPropertyChanging, INotifyPropertyChanged //This class should be abstract but it can't be done AND achieve the Children property like this
|
||||
{
|
||||
#region Internal Storage
|
||||
private int _Id;
|
||||
private string _name;
|
||||
private string _versionId;
|
||||
private int _parentId;
|
||||
private int _writerID;
|
||||
private User _writer;
|
||||
private int _creatorID;
|
||||
private User _creator;
|
||||
private IEnumerable<DocTypeBase> _ancestors;
|
||||
private AssociationTree<DocTypeBase> _children;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocTypeBase"/> class.
|
||||
/// </summary>
|
||||
public DocTypeBase()
|
||||
{
|
||||
this.IsDirty = true;
|
||||
}
|
||||
|
||||
internal void LoadFromXml(XElement xml)
|
||||
{
|
||||
if (xml.Name != "node")
|
||||
{
|
||||
throw new ArgumentException("Xml provided is not valid");
|
||||
}
|
||||
|
||||
if (!ReflectionAssistance.CompareByAlias(this.GetType(), xml))
|
||||
{
|
||||
throw new DocTypeMissMatchException((string)xml.Attribute("nodeTypeAlias"), ReflectionAssistance.GetumbracoInfoAttribute(this.GetType()).Alias);
|
||||
}
|
||||
|
||||
this.Id = (int)xml.Attribute("id");
|
||||
this.ParentNodeId = (int)xml.Attribute("parentID");
|
||||
this.Name = (string)xml.Attribute("nodeName");
|
||||
this.Version = (string)xml.Attribute("version");
|
||||
this.CreateDate = (DateTime)xml.Attribute("createDate");
|
||||
this.SortOrder = (int)xml.Attribute("sortOrder");
|
||||
this.UpdateDate = (DateTime)xml.Attribute("updateDate");
|
||||
this._creatorID = (int)xml.Attribute("creatorID");
|
||||
this._writerID = (int)xml.Attribute("writerID");
|
||||
this.Level = (int)xml.Attribute("level");
|
||||
|
||||
var properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => p.GetCustomAttributes(typeof(PropertyAttribute), true).Count() > 0);
|
||||
foreach (var p in properties)
|
||||
{
|
||||
var attr = ReflectionAssistance.GetumbracoInfoAttribute(p);
|
||||
|
||||
var data = xml.Elements("data").Single(x => (string)x.Attribute("alias") == attr.Alias);
|
||||
// TODO: Address how Convert.ChangeType works in globalisation
|
||||
p.SetValue(this, Convert.ChangeType(data.Value, p.PropertyType), null);
|
||||
}
|
||||
}
|
||||
|
||||
internal umbracoDataProvider Provider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance has been modified since it was first loaded
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has been modified; otherwise, <c>false</c>.</value>
|
||||
public bool IsDirty { get; protected internal set; }
|
||||
|
||||
#region Fields
|
||||
/// <summary>
|
||||
/// Gets or sets the id of the umbraco item
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
[Field]
|
||||
[UmbracoInfo("id", DisplayName = "Id", Mandatory = true), DataMember(Name = "Id")]
|
||||
public virtual int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Id;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
if (this._Id != value)
|
||||
{
|
||||
this.RaisePropertyChanging();
|
||||
this._Id = value;
|
||||
this.RaisePropertyChanged("Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name (title) of the umbraco item
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[Field]
|
||||
[UmbracoInfo("nodeName", DisplayName = "Name", Mandatory = true), DataMember(Name = "Name")]
|
||||
public virtual string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this._name != value)
|
||||
{
|
||||
this.RaisePropertyChanging();
|
||||
this._name = value;
|
||||
this.IsDirty = true;
|
||||
this.RaisePropertyChanged("Name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the version of the umbraco item
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
[Field]
|
||||
[UmbracoInfo("version", DisplayName = "Version", Mandatory = true), DataMember(Name = "Version")]
|
||||
public virtual string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._versionId;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
if (this._versionId != value)
|
||||
{
|
||||
this.RaisePropertyChanging();
|
||||
this._versionId = value;
|
||||
this.RaisePropertyChanged("Version");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ID of the parent node.
|
||||
/// </summary>
|
||||
/// <value>The parent node id.</value>
|
||||
[Field]
|
||||
[UmbracoInfo("parentID", DisplayName = "ParentId", Mandatory = true), DataMember(Name = "ParentId")]
|
||||
public virtual int ParentNodeId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._parentId;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this._parentId != value)
|
||||
{
|
||||
this.RaisePropertyChanging();
|
||||
this._parentId = value;
|
||||
this.RaisePropertyChanged("Version");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the created date.
|
||||
/// </summary>
|
||||
/// <value>The create date.</value>
|
||||
[Field]
|
||||
[UmbracoInfo("createDate", DisplayName = "CreateDate"), DataMember(Name = "CreateDate")]
|
||||
public virtual DateTime CreateDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sort order.
|
||||
/// </summary>
|
||||
/// <value>The sort order.</value>
|
||||
[Field]
|
||||
[UmbracoInfo("sortOrder", DisplayName = "SortOrder"), DataMember(Name = "SortOrder")]
|
||||
public virtual int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last updated date of the current version
|
||||
/// </summary>
|
||||
/// <value>The update date.</value>
|
||||
[Field]
|
||||
[UmbracoInfo("updateDate", DisplayName = "UpdateDate"), DataMember(Name = "UpdateDate")]
|
||||
public virtual DateTime UpdateDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the level of this item in the content tree
|
||||
/// </summary>
|
||||
/// <value>The level.</value>
|
||||
[Field]
|
||||
[UmbracoInfo("level", DisplayName="Level"), DataMember(Name="Level")]
|
||||
public virtual int Level { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Parents and Children
|
||||
/// <summary>
|
||||
/// Gets the children of this DocType instance.
|
||||
/// </summary>
|
||||
/// <value>The children of this DocType instance.</value>
|
||||
public AssociationTree<DocTypeBase> Children
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._children == null)
|
||||
{
|
||||
this._children = this.Provider.LoadAssociation(this.Id); //tell the provider to create it
|
||||
}
|
||||
|
||||
return this._children;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the children which are of the type TDocTypeBase.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocTypeBase">The DocType of the children desired.</typeparam>
|
||||
/// <returns>An <see cref="umbraco.Linq.Core.AssociationTree<TDocTypeBase>"/> of the children</returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
|
||||
protected AssociationTree<TDocTypeBase> ChildrenOfType<TDocTypeBase>() where TDocTypeBase : DocTypeBase, new()
|
||||
{
|
||||
return this.Provider.LoadAssociation<TDocTypeBase>(this.Children.Where(d => d is TDocTypeBase).Cast<TDocTypeBase>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parent this instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="TParent">The type of the parent.</typeparam>
|
||||
/// <returns>Null when at the root level, else the parent instance</returns>
|
||||
/// <exception cref="umbraco.Linq.Core.DocTypeMissMatchException">If the type of the parent does not match the provided type</exception>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
|
||||
public virtual TParent Parent<TParent>() where TParent : DocTypeBase, new()
|
||||
{
|
||||
if (this._parentId == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.Provider.Load<TParent>(this._parentId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the first matching ancestor of the current type
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Provides similar functionality to the XPath method
|
||||
/// </remarks>
|
||||
/// <returns>First ancestor matching type. Null if no match found</returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
|
||||
public TDocType AncestorOrDefault<TDocType>() where TDocType : DocTypeBase
|
||||
{
|
||||
return this.AncestorOrDefault<TDocType>(t => true); //just a simple little true statement ;)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the first matching ancestor of the current type and additional boolean function
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocType">The type of the doc type.</typeparam>
|
||||
/// <param name="func">Additional boolean operation to filter on</param>
|
||||
/// <returns>First ancestor matching type and function. Null if no match found</returns>
|
||||
/// <exception cref="System.ArgumentNullException">Func parameter required</exception>
|
||||
public TDocType AncestorOrDefault<TDocType>(Func<TDocType, bool> func) where TDocType : DocTypeBase
|
||||
{
|
||||
if (func == null)
|
||||
{
|
||||
throw new ArgumentNullException("func");
|
||||
}
|
||||
|
||||
if (this._ancestors == null)
|
||||
{
|
||||
this._ancestors = this.Provider.LoadAncestors(this.Id);
|
||||
}
|
||||
|
||||
return this._ancestors.Where(a => a is TDocType).Cast<TDocType>().FirstOrDefault(func);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gets the umbraco user who created the item
|
||||
/// </summary>
|
||||
/// <value>The creator.</value>
|
||||
public virtual User Creator
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._creator == null)
|
||||
{
|
||||
this._creator = new User(this._creatorID);
|
||||
}
|
||||
|
||||
return this._creator;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the umbraco user who last edited the instance
|
||||
/// </summary>
|
||||
/// <value>The writer.</value>
|
||||
public virtual User Writer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._writer == null)
|
||||
{
|
||||
this._writer = new User(this._writerID);
|
||||
}
|
||||
|
||||
return this._writer;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the property changing event.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
|
||||
protected virtual void RaisePropertyChanging()
|
||||
{
|
||||
if (this.PropertyChanging != null)
|
||||
{
|
||||
this.PropertyChanging(this, new PropertyChangingEventArgs(String.Empty));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the property changed event.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the changed property.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
|
||||
protected virtual void RaisePropertyChanged(string name)
|
||||
{
|
||||
if (this.PropertyChanged != null)
|
||||
{
|
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
}
|
||||
|
||||
#region INotifyPropertyChanging Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a property value is changing.
|
||||
/// </summary>
|
||||
public event PropertyChangingEventHandler PropertyChanging;
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
using System;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Exception for when the provided class does not meet the expected class
|
||||
/// </summary>
|
||||
[global::System.Serializable]
|
||||
public class DocTypeMissMatchException : ArgumentException
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocTypeMissMatchException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="actual">The actual doc type alias.</param>
|
||||
/// <param name="expected">The expcected doc type alias.</param>
|
||||
public DocTypeMissMatchException(string actual, string expected) : this(actual, expected, string.Empty) { }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocTypeMissMatchException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="actual">The actual doc type alias.</param>
|
||||
/// <param name="expected">The expcected doc type alias.</param>
|
||||
/// <param name="message">Additional message information.</param>
|
||||
public DocTypeMissMatchException(string actual, string expected, string message)
|
||||
: base(string.Format("DocTypeAlias provided did not match what was expected (provided: {0}, expected: {1}){2}{3}", actual, expected, Environment.NewLine, message))
|
||||
{
|
||||
Expected = expected;
|
||||
Actual = actual;
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocTypeMissMatchException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="actual">The actual doc type alias.</param>
|
||||
/// <param name="expected">The expcected doc type alias.</param>
|
||||
/// <param name="message">Additional message information.</param>
|
||||
/// <param name="innerException">The inner exception.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object[])")]
|
||||
public DocTypeMissMatchException(string actual, string expected, string message, Exception innerException)
|
||||
: base(string.Format("DocTypeAlias provided did not match what was expected (provided: {0}, expected: {1}){2}{3}", actual, expected, Environment.NewLine, message), innerException)
|
||||
{
|
||||
Expected = expected;
|
||||
Actual = actual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MandatoryFailureException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// The <paramref name="info"/> parameter is null.
|
||||
/// </exception>
|
||||
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
|
||||
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
|
||||
/// </exception>
|
||||
protected DocTypeMissMatchException(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
: base(info, context) { }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the expected DocTypeAlias
|
||||
/// </summary>
|
||||
/// <value>The expected DocTypeAlias.</value>
|
||||
public string Expected { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the actual DocTypeAlias
|
||||
/// </summary>
|
||||
/// <value>The actual DocTypeAlias.</value>
|
||||
public string Actual { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exception raised when a field isn't meeting its mandatory requirement
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors"), global::System.Serializable]
|
||||
public class MandatoryFailureException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MandatoryFailureException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">Name of the property that failed the mandatory check.</param>
|
||||
public MandatoryFailureException(string propertyName) : this(propertyName, string.Empty) { }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MandatoryFailureException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">Name of the property that failed the mandatory check.</param>
|
||||
/// <param name="message">Additional message information.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)")]
|
||||
public MandatoryFailureException(string propertyName, string message)
|
||||
: base(string.Format("The mandatory property \"{0}\" did not have a value.{1}{2}", propertyName, Environment.NewLine, message))
|
||||
{
|
||||
PropertyName = propertyName;
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MandatoryFailureException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">Name of the property that failed the mandatory check.</param>
|
||||
/// <param name="message">Additional message information.</param>
|
||||
/// <param name="innerException">The inner exception.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)")]
|
||||
public MandatoryFailureException(string propertyName, string message, Exception innerException)
|
||||
: base(string.Format("The mandatory property \"{0}\" did not have a value.{1}{2}", propertyName, Environment.NewLine, message), innerException)
|
||||
{
|
||||
PropertyName = propertyName;
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MandatoryFailureException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// The <paramref name="info"/> parameter is null.
|
||||
/// </exception>
|
||||
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
|
||||
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
|
||||
/// </exception>
|
||||
protected MandatoryFailureException(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
: base(info, context) { }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the property the exception was raised for.
|
||||
/// </summary>
|
||||
/// <value>The name of the property.</value>
|
||||
public string PropertyName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
//
|
||||
// To add a suppression to this file, right-click the message in the
|
||||
// Error List, point to "Suppress Message(s)", and click
|
||||
// "In Project Suppression File".
|
||||
// You do not need to add suppressions to this file manually.
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "namespace", Target = "umbraco.Linq.Core")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "umbraco.Linq.Core.Node")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "namespace", Target = "umbraco.Linq.Core.Node")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "umbraco.Linq.Core.DocTypeMissMatchException")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object[])", Scope = "member", Target = "umbraco.Linq.Core.DocTypeMissMatchException.#.ctor(System.String,System.String,System.String)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "member", Target = "umbraco.Linq.Core.ReflectionAssistance.#GetumbracoInfoAttribute(System.Type)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "type", Target = "umbraco.Linq.Core.umbracoDataContext")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "type", Target = "umbraco.Linq.Core.umbracoDataProvider")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "umbraco.Linq.Core.umbracoDataProvider.#Load`1(System.Int32)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "umbraco.Linq.Core.umbracoDataProvider.#LoadTree`1()")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco", Scope = "type", Target = "umbraco.Linq.Core.umbracoInfoAttribute")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Scope = "type", Target = "umbraco.Linq.Core.Node.NodeAssociationTree`1")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "umbraco.Linq.Core.Node.NodeDataProvider.#LoadTree`1()")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Scope = "type", Target = "umbraco.Linq.Core.Node.NodeTree`1")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "umbraco.Linq.Core.Node.NodeDataProvider.#Load`1(System.Int32)")]
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Base of an umbraco content tree
|
||||
/// </summary>
|
||||
public interface ITree
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="umbracoDataProvider"/> Provider associated with this instance
|
||||
/// </summary>
|
||||
/// <value>The provider.</value>
|
||||
umbracoDataProvider Provider { get; }
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is read only.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is read only; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
bool IsReadOnly { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the cache for the particular tree
|
||||
/// </summary>
|
||||
void ReloadCache();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace umbraco.Linq.Core.Node
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a collection of TDocTypeBase retrieved from the umbraco XML cache which are direct children of a node
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocTypeBase">The type of the doc type base.</typeparam>
|
||||
public sealed class NodeAssociationTree<TDocTypeBase> : AssociationTree<TDocTypeBase> where TDocTypeBase : DocTypeBase, new()
|
||||
{
|
||||
private IEnumerable<TDocTypeBase> _nodes;
|
||||
|
||||
internal NodeAssociationTree(IEnumerable<TDocTypeBase> nodes)
|
||||
{
|
||||
this._nodes = new List<TDocTypeBase>();
|
||||
this._nodes = nodes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeAssociationTree<TDocTypeBase>"/> class for a particular tree section
|
||||
/// </summary>
|
||||
/// <param name="parentNodeId">The parent node id to start from.</param>
|
||||
/// <param name="provider">The NodeDataProvider to link the tree with.</param>
|
||||
public NodeAssociationTree(int parentNodeId, NodeDataProvider provider)
|
||||
{
|
||||
this.Provider = provider;
|
||||
this.ParentNodeId = parentNodeId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the enumerator for this Tree collection
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override IEnumerator<TDocTypeBase> GetEnumerator()
|
||||
{
|
||||
if (this._nodes == null) //first access, otherwise it'd be cached
|
||||
{
|
||||
LoadNodes();
|
||||
}
|
||||
return this._nodes.GetEnumerator();
|
||||
}
|
||||
|
||||
private void LoadNodes()
|
||||
{
|
||||
var provider = this.Provider as NodeDataProvider;
|
||||
|
||||
provider.CheckDisposed();
|
||||
|
||||
var rawNodes = provider.Xml.Descendants("node")
|
||||
.Where(x => (int)x.Attribute("id") == this.ParentNodeId)
|
||||
.Single()
|
||||
.Elements("node")
|
||||
;
|
||||
this._nodes = provider.DynamicNodeCreation(rawNodes).Cast<TDocTypeBase>(); //drop is back to the type which was asked for
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the NodeAssociationTree is ReadOnly
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c>
|
||||
/// </value>
|
||||
public override bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DataProvider associated with this Tree
|
||||
/// </summary>
|
||||
/// <value>The provider.</value>
|
||||
public override umbracoDataProvider Provider { get; protected set; }
|
||||
|
||||
public override void ReloadCache()
|
||||
{
|
||||
this.LoadNodes();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Linq.Expressions;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Schema;
|
||||
|
||||
namespace umbraco.Linq.Core.Node
|
||||
{
|
||||
/// <summary>
|
||||
/// Data Provider for LINQ to umbraco via umbraco ndoes
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class provides a data access model for the umbraco XML cache.
|
||||
/// It is responsible for the access to the XML and construction of nodes from it.
|
||||
///
|
||||
/// The <see cref="umbraco.Linq.Core.Node.NodeDataProvider"/> is capable of reading the XML cache from either the path provided in the umbraco settings or from a specified location on the file system.
|
||||
/// </remarks>
|
||||
public sealed class NodeDataProvider : umbracoDataProvider
|
||||
{
|
||||
private string _xmlPath;
|
||||
private Dictionary<UmbracoInfoAttribute, ITree> _trees;
|
||||
private bool _enforceSchemaValidation;
|
||||
private XDocument _xml;
|
||||
private const string UMBRACO_XSD_PATH = "umbraco.Linq.Core.Node.umbracoConfig.xsd";
|
||||
private Dictionary<string, Type> _knownTypes;
|
||||
|
||||
internal XDocument Xml
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._xml == null)
|
||||
{
|
||||
this._xml = XDocument.Load(this._xmlPath);
|
||||
|
||||
if (this._enforceSchemaValidation)
|
||||
{
|
||||
XmlSchemaSet schemas = new XmlSchemaSet();
|
||||
//read the resorce for the XSD to validate against
|
||||
schemas.Add("", System.Xml.XmlReader.Create(this.GetType().Assembly.GetManifestResourceStream(UMBRACO_XSD_PATH)));
|
||||
|
||||
//we'll have a list of all validation exceptions to put them to the screen
|
||||
List<XmlSchemaException> exList = new List<XmlSchemaException>();
|
||||
|
||||
//some funky in-line event handler. Lambda loving goodness ;)
|
||||
this._xml.Validate(schemas, (o, e) => { exList.Add(e.Exception); });
|
||||
|
||||
if (exList.Count > 0)
|
||||
{
|
||||
//dump out the exception list
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("The following validation errors occuring with the XML:");
|
||||
foreach (var item in exList)
|
||||
{
|
||||
sb.AppendLine(" * " + item.Message + " - " + item.StackTrace);
|
||||
}
|
||||
throw new XmlSchemaException(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this._xml; //cache the XML in memory to increase performance and force the disposable pattern
|
||||
}
|
||||
}
|
||||
|
||||
private void Init(string xmlPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(xmlPath))
|
||||
{
|
||||
throw new ArgumentNullException("xmlPath");
|
||||
}
|
||||
|
||||
if (!File.Exists(xmlPath))
|
||||
{
|
||||
throw new FileNotFoundException("The XML used by the provider must exist", xmlPath);
|
||||
}
|
||||
this._xmlPath = xmlPath;
|
||||
|
||||
this._trees = new Dictionary<UmbracoInfoAttribute, ITree>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeDataProvider"/> class using umbraco settings as XML path
|
||||
/// </summary>
|
||||
public NodeDataProvider()
|
||||
: this(System.Web.HttpContext.Current.Server.MapPath(umbraco.GlobalSettings.Path))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeDataProvider"/> class
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This constructor is ideal for unit testing as it allows for the XML to be located anywhere
|
||||
/// </remarks>
|
||||
/// <param name="xmlPath">The path of the umbraco XML</param>
|
||||
public NodeDataProvider(string xmlPath)
|
||||
: this(xmlPath, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeDataProvider"/> class.
|
||||
/// </summary>
|
||||
/// <param name="xmlPath">The XML path.</param>
|
||||
/// <param name="enforceValidation">if set to <c>true</c> when the XML document is accessed validation against the umbraco XSD will be done.</param>
|
||||
/// <exception cref="System.ArgumentNullException">Thrown when the xmlPath is null</exception>
|
||||
/// <exception cref="System.IO.FileNotFoundException">Thrown when the xmlPath does not resolve to a physical file</exception>
|
||||
public NodeDataProvider(string xmlPath, bool enforceValidation)
|
||||
{
|
||||
this.Init(xmlPath);
|
||||
this._enforceSchemaValidation = enforceValidation;
|
||||
}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// Releases unmanaged and - optionally - managed resources
|
||||
/// </summary>
|
||||
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
||||
protected internal override void Dispose(bool disposing)
|
||||
{
|
||||
if (!this._disposed && disposing)
|
||||
{
|
||||
this._xmlPath = null;
|
||||
|
||||
this._disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal void CheckDisposed()
|
||||
{
|
||||
if (this._disposed)
|
||||
{
|
||||
throw new ObjectDisposedException(null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the provider
|
||||
/// </summary>
|
||||
/// <value>The name of the provider.</value>
|
||||
public override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "NodeDataProvider";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the tree with the relivent DocTypes from the XML
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocType">The type of the DocType to load.</typeparam>
|
||||
/// <returns><see cref="umbraco.Linq.Core.Node.NodeTree<TDocType>"/> representation of the content tree</returns>
|
||||
/// <exception cref="System.ObjectDisposedException">When the data provider has been disposed of</exception>
|
||||
public override Tree<TDocType> LoadTree<TDocType>()
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
var attr = ReflectionAssistance.GetumbracoInfoAttribute(typeof(TDocType));
|
||||
|
||||
if (!this._trees.ContainsKey(attr))
|
||||
{
|
||||
SetupNodeTree<TDocType>(attr);
|
||||
}
|
||||
|
||||
return (NodeTree<TDocType>)this._trees[attr];
|
||||
}
|
||||
|
||||
internal void SetupNodeTree<TDocType>(UmbracoInfoAttribute attr) where TDocType : DocTypeBase, new()
|
||||
{
|
||||
var tree = new NodeTree<TDocType>(this);
|
||||
if (!this._trees.ContainsKey(attr))
|
||||
{
|
||||
this._trees.Add(attr, tree); //cache so it's faster to get next time
|
||||
}
|
||||
else
|
||||
{
|
||||
this._trees[attr] = tree;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the specified id.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocType">The type of the doc type.</typeparam>
|
||||
/// <param name="id">The id.</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="umbraco.Linq.Core.DocTypeMissMatchException">If the type of the parent does not match the provided type</exception>
|
||||
/// <exception cref="System.ArgumentException">No node found matching the provided ID for the parent</exception>
|
||||
/// <exception cref="System.ObjectDisposedException">When the data provider has been disposed of</exception>
|
||||
public override TDocType Load<TDocType>(int id)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
var parentXml = this.Xml.Descendants("node").SingleOrDefault(d => (int)d.Attribute("id") == id);
|
||||
|
||||
if (!ReflectionAssistance.CompareByAlias(typeof(TDocType), parentXml))
|
||||
{
|
||||
throw new DocTypeMissMatchException((string)parentXml.Attribute("nodeTypeAlias"), ReflectionAssistance.GetumbracoInfoAttribute(typeof(TDocType)).Alias);
|
||||
}
|
||||
|
||||
if (parentXml == null) //really shouldn't happen!
|
||||
{
|
||||
throw new ArgumentException("Parent ID \"" + id + "\" cannot be found in the loaded XML. Ensure that the umbracoDataContext is being disposed of once it is no longer needed");
|
||||
}
|
||||
|
||||
var parent = new TDocType();
|
||||
parent.LoadFromXml(parentXml);
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the associated (children) nodes with the relivent DocTypes
|
||||
/// </summary>
|
||||
/// <param name="parentNodeId">The parent node id.</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.ObjectDisposedException">When the data provider has been disposed of</exception>
|
||||
public override AssociationTree<DocTypeBase> LoadAssociation(int parentNodeId)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
NodeAssociationTree<DocTypeBase> associationTree = new NodeAssociationTree<DocTypeBase>(parentNodeId, this);
|
||||
|
||||
return associationTree;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Loads the associated nodes with the relivent DocTypes
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocType">The type of the DocType to load.</typeparam>
|
||||
/// <param name="nodes">The nodes.</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.ObjectDisposedException">When the data provider has been disposed of</exception>
|
||||
public override AssociationTree<TDocType> LoadAssociation<TDocType>(IEnumerable<TDocType> nodes)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
return new NodeAssociationTree<TDocType>(nodes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the ancestors for a node
|
||||
/// </summary>
|
||||
/// <param name="startNodeId">The start node id.</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.ObjectDisposedException">When the data provider has been disposed of</exception>
|
||||
public override IEnumerable<DocTypeBase> LoadAncestors(int startNodeId)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
var startElement = this.Xml.Descendants("node").Single(x => (int)x.Attribute("id") == startNodeId);
|
||||
var ancestorElements = startElement.Ancestors("node");
|
||||
|
||||
IEnumerable<DocTypeBase> ancestors = DynamicNodeCreation(ancestorElements);
|
||||
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a collection of nodes with the type specified from the XML
|
||||
/// </summary>
|
||||
/// <param name="elements">The elements.</param>
|
||||
/// <returns>Collecton of .NET types from the XML</returns>
|
||||
internal IEnumerable<DocTypeBase> DynamicNodeCreation(IEnumerable<XElement> elements)
|
||||
{
|
||||
// TODO: investigate this method for performance bottlenecks
|
||||
// TODO: dataContext knows the types, maybe can load from there?
|
||||
List<DocTypeBase> ancestors = new List<DocTypeBase>();
|
||||
|
||||
foreach (var ancestor in elements)
|
||||
{
|
||||
var alias = (string)ancestor.Attribute("nodeTypeAlias");
|
||||
var t = KnownTypes[alias];
|
||||
var instaceOfT = (DocTypeBase)Activator.CreateInstance(t); //create an instance of the type and down-cast so we can use it
|
||||
instaceOfT.LoadFromXml(ancestor);
|
||||
instaceOfT.Provider = this;
|
||||
ancestors.Add(instaceOfT);
|
||||
yield return instaceOfT;
|
||||
}
|
||||
|
||||
//return ancestors;
|
||||
}
|
||||
|
||||
//Will this cause a problem with trust levels...?
|
||||
internal Dictionary<string, Type> KnownTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._knownTypes == null)
|
||||
{
|
||||
this._knownTypes = (from a in AppDomain.CurrentDomain.GetAssemblies()
|
||||
from t in a.GetTypes()
|
||||
where t.GetCustomAttributes(typeof(DocTypeAttribute), true).Length == 1
|
||||
select t).ToDictionary(k => ((UmbracoInfoAttribute)k.GetCustomAttributes(typeof(UmbracoInfoAttribute), true)[0]).Alias);
|
||||
}
|
||||
|
||||
return this._knownTypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace umbraco.Linq.Core.Node
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a collection of TDocTypeBase retrieved from the umbraco XML cache
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocTypeBase">The type of the doc type base.</typeparam>
|
||||
public sealed class NodeTree<TDocTypeBase> : Tree<TDocTypeBase> where TDocTypeBase : DocTypeBase, new()
|
||||
{
|
||||
private NodeDataProvider _provider;
|
||||
|
||||
private List<TDocTypeBase> _nodes;
|
||||
|
||||
internal NodeTree(NodeDataProvider provider)
|
||||
{
|
||||
this._provider = provider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the provider.
|
||||
/// </summary>
|
||||
/// <value>The provider.</value>
|
||||
public override umbracoDataProvider Provider
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._provider;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
var nodeProvider = value as NodeDataProvider;
|
||||
if (nodeProvider == null)
|
||||
{
|
||||
throw new ArgumentException("Value must be of type NodeDataProvider");
|
||||
}
|
||||
this._provider = nodeProvider;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the NodeTree is ReadOnly
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c>
|
||||
/// </value>
|
||||
public override bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the enumerator.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override IEnumerator<TDocTypeBase> GetEnumerator()
|
||||
{
|
||||
if (this._nodes == null)
|
||||
{
|
||||
this._nodes = new List<TDocTypeBase>();
|
||||
var rawNodes = this._provider.Xml.Descendants("node").Where(x => ReflectionAssistance.CompareByAlias(typeof(TDocTypeBase), x));
|
||||
|
||||
foreach (XElement n in rawNodes)
|
||||
{
|
||||
var dt = new TDocTypeBase();
|
||||
dt.LoadFromXml(n);
|
||||
|
||||
dt.IsDirty = false;
|
||||
dt.Provider = this._provider;
|
||||
|
||||
this._nodes.Add(dt);
|
||||
}
|
||||
}
|
||||
return this._nodes.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the cache for the particular NodeTree
|
||||
/// </summary>
|
||||
public override void ReloadCache()
|
||||
{
|
||||
this._provider.CheckDisposed();
|
||||
|
||||
var attr = ReflectionAssistance.GetumbracoInfoAttribute(typeof(TDocTypeBase));
|
||||
this._provider.SetupNodeTree<TDocTypeBase>(attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Core")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("Core")]
|
||||
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("umbraco.Linq.Core.Tests")]
|
||||
[assembly: ComVisible(false)]
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing helpers when doing reflection against nodes
|
||||
/// </summary>
|
||||
public sealed class ReflectionAssistance
|
||||
{
|
||||
private ReflectionAssistance() { }
|
||||
|
||||
/// <summary>
|
||||
/// Prebuilt function for getting the custom properites of the class
|
||||
/// </summary>
|
||||
/// <remarks>This is a Lambda function which will return all the properties of the current class which are custom DocType properties</remarks>
|
||||
internal static Func<PropertyInfo, bool> CustomDocTypeProperties = p => p.GetCustomAttributes(typeof(UmbracoInfoAttribute), false).Count() != 0 && p.GetCustomAttributes(typeof(PropertyAttribute), false).Count() != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Prebuild function for getting the mandatory properites of the class
|
||||
/// </summary>
|
||||
/// <remarks>This is a Lambda function which will return all the properties of the current class which are custom DocType properties and mandatory</remarks>
|
||||
internal static Func<PropertyInfo, bool> MandatoryDocTypeProperties = p => p.GetCustomAttributes(typeof(UmbracoInfoAttribute), false).Count() != 0 && ((UmbracoInfoAttribute)p.GetCustomAttributes(typeof(UmbracoInfoAttribute), false)[0]).Mandatory;
|
||||
|
||||
/// <summary>
|
||||
/// Compares a .NET type to an Xml representation
|
||||
/// </summary>
|
||||
internal static Func<Type, XElement, bool> CompareByAlias = (t, x) => (string)x.Attribute("nodeTypeAlias") == ReflectionAssistance.GetumbracoInfoAttribute(t).Alias;
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="umbraco.Linq.Core.umbracoInfoAttribute"/> for a <see cref="System.Reflection.MethodInfo"/> object
|
||||
/// </summary>
|
||||
/// <param name="member">The methodInfo to get the <see cref="umbraco.Linq.Core.umbracoInfoAttribute"/> for.</param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "umbraco")]
|
||||
public static UmbracoInfoAttribute GetumbracoInfoAttribute(MemberInfo member)
|
||||
{
|
||||
return member.GetCustomAttributes(typeof(UmbracoInfoAttribute), true).Cast<UmbracoInfoAttribute>().SingleOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="umbraco.Linq.Core.umbracoInfoAttribute"/> for a type
|
||||
/// </summary>
|
||||
/// <param name="type">The type to get the <see cref="umbraco.Linq.Core.umbracoInfoAttribute"/> for.</param>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
|
||||
public static UmbracoInfoAttribute GetumbracoInfoAttribute(Type type)
|
||||
{
|
||||
return type.GetCustomAttributes(typeof(UmbracoInfoAttribute), true).Cast<UmbracoInfoAttribute>().SingleOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Typed switch implementation from Bart De Smet: http://community.bartdesmet.net/blogs/bart/archive/2008/03/30/a-functional-c-type-switch.aspx
|
||||
/// </summary>
|
||||
public class Switch
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Switch"/> class.
|
||||
/// </summary>
|
||||
/// <param name="o">The o.</param>
|
||||
public Switch(object o)
|
||||
{
|
||||
Obj = o;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the object being operated against
|
||||
/// </summary>
|
||||
/// <value>The obj.</value>
|
||||
public object Obj { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Case statement
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object</typeparam>
|
||||
/// <param name="a">Action method to execute for case evaluation</param>
|
||||
/// <returns></returns>
|
||||
public Switch Case<T>(Action<T> a)
|
||||
{
|
||||
return Case<T>(o => true, a, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Case statement
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object</typeparam>
|
||||
/// <param name="a">Action method to execute for case evaluation</param>
|
||||
/// <param name="fallThrough">if set to <c>true</c> fall through to next case statement.</param>
|
||||
/// <returns></returns>
|
||||
public Switch Case<T>(Action<T> a, bool fallThrough)
|
||||
{
|
||||
return Case<T>(o => true, a, fallThrough);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Case statement
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object</typeparam>
|
||||
/// <param name="c">The funcation to eveluate against to object.</param>
|
||||
/// <param name="a">Action method to execute for case evaluation</param>
|
||||
/// <returns></returns>
|
||||
public Switch Case<T>(Func<T, bool> c, Action<T> a)
|
||||
{
|
||||
return Case<T>(c, a, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Case statement
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object</typeparam>
|
||||
/// <param name="c">The funcation to eveluate against to object.</param>
|
||||
/// <param name="a">Action method to execute for case evaluation</param>
|
||||
/// <param name="fallThrough">if set to <c>true</c> fall through to next case statement.</param>
|
||||
/// <returns></returns>
|
||||
public Switch Case<T>(Func<T, bool> c, Action<T> a, bool fallThrough)
|
||||
{
|
||||
if (this == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.Obj is T)
|
||||
{
|
||||
T t = (T)this.Obj;
|
||||
if (c(t))
|
||||
{
|
||||
a(t);
|
||||
return fallThrough ? this : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults case
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object</typeparam>
|
||||
/// <param name="a">Action to perform</param>
|
||||
/// <returns></returns>
|
||||
public Switch Default<T>(Action<T> a)
|
||||
{
|
||||
if (this == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
a((T)this.Obj);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Linq.Expressions;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a collection within DataProvider of a DocType
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Similar to the implementation of <see cref="System.Data.Linq.Table<T>"/>,
|
||||
/// providing a single collection which represents all instances of the given type within the DataProvider.
|
||||
///
|
||||
/// Implementers of this type will need to provide a manner of retrieving the TDocType from the DataProvider
|
||||
/// </remarks>
|
||||
/// <typeparam name="TDocType">The type of the DocType.</typeparam>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
|
||||
public abstract class Tree<TDocType> : ITree, IEnumerable<TDocType>, IEnumerable
|
||||
where TDocType : DocTypeBase, new()
|
||||
{
|
||||
#region ITree Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="umbracoDataProvider"/> Provider associated with this instance
|
||||
/// </summary>
|
||||
/// <value>The provider.</value>
|
||||
public abstract umbracoDataProvider Provider { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is read only. The collection is not ReadOnly by default
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>false</c> to indicate that this collection isn't read-only
|
||||
/// </value>
|
||||
public virtual bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void ReloadCache();
|
||||
|
||||
#endregion
|
||||
|
||||
#region IEnumerable<TDocType> Members
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that iterates through the collection.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
|
||||
/// </returns>
|
||||
public abstract IEnumerator<TDocType> GetEnumerator();
|
||||
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using umbraco.Linq.Core.Node;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// The umbracoDataContext which handles the interaction with an <see cref="umbracoDataProvider"/>
|
||||
/// </summary>
|
||||
public abstract class umbracoDataContext : IDisposable
|
||||
{
|
||||
#region Privates
|
||||
private umbracoDataProvider _dataProvider;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Loads the tree of umbraco items.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocTypeBase">The type of the DocTypeBase.</typeparam>
|
||||
/// <returns>Collection of umbraco items</returns>
|
||||
/// <exception cref="System.ObjectDisposedException">If the DataContext has been disposed of</exception>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
|
||||
protected Tree<TDocTypeBase> LoadTree<TDocTypeBase>() where TDocTypeBase : DocTypeBase, new()
|
||||
{
|
||||
CheckDisposed();
|
||||
return this._dataProvider.LoadTree<TDocTypeBase>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data provider.
|
||||
/// </summary>
|
||||
/// <value>The data provider.</value>
|
||||
public umbracoDataProvider DataProvider
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._dataProvider;
|
||||
}
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="umbracoDataContext"/> class, using a <see cref="umbraco.Linq.Core.Node.NodeDataProvider"/> data provider with the connection string from the umbraco config
|
||||
/// </summary>
|
||||
protected umbracoDataContext() : this(new NodeDataProvider())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="umbracoDataContext"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dataProvider">The data provider to use within the DataContext.</param>
|
||||
protected umbracoDataContext(umbracoDataProvider dataProvider)
|
||||
{
|
||||
this._dataProvider = dataProvider;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases unmanaged and - optionally - managed resources
|
||||
/// </summary>
|
||||
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this._disposed && disposing)
|
||||
{
|
||||
if (this._dataProvider != null)
|
||||
{
|
||||
this._dataProvider.Dispose(true);
|
||||
}
|
||||
|
||||
this._disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckDisposed()
|
||||
{
|
||||
if (this._disposed)
|
||||
{
|
||||
throw new ObjectDisposedException(null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace umbraco.Linq.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the methods required for a data access model within the LINQ to umbraco project
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This base class is used when defining how a DataProvider operates against a data source (such as the umbraco.config).
|
||||
///
|
||||
/// It provides abstractions for all the useful operations of the DataProvider
|
||||
/// </remarks>
|
||||
public abstract class umbracoDataProvider : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of the provider
|
||||
/// </summary>
|
||||
/// <value>The name of the provider.</value>
|
||||
public abstract string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads the tree with the relivent DocTypes
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocType">The type of the DocType to load.</typeparam>
|
||||
/// <returns></returns>
|
||||
public abstract Tree<TDocType> LoadTree<TDocType>() where TDocType : DocTypeBase, new();
|
||||
|
||||
/// <summary>
|
||||
/// Loads the associated nodes with the relivent DocTypes
|
||||
/// </summary>
|
||||
/// <param name="parentNodeId">The parent node id.</param>
|
||||
/// <returns></returns>
|
||||
public abstract AssociationTree<DocTypeBase> LoadAssociation(int parentNodeId);
|
||||
|
||||
/// <summary>
|
||||
/// Loads the associated nodes with the relivent DocTypes
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocType">The type of the DocType to load.</typeparam>
|
||||
/// <param name="nodes">The nodes.</param>
|
||||
/// <returns></returns>
|
||||
public abstract AssociationTree<TDocType> LoadAssociation<TDocType>(IEnumerable<TDocType> nodes) where TDocType : DocTypeBase, new();
|
||||
|
||||
/// <summary>
|
||||
/// Loads the specified id.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocType">The type of the doc type.</typeparam>
|
||||
/// <param name="id">The id.</param>
|
||||
/// <returns></returns>
|
||||
public abstract TDocType Load<TDocType>(int id) where TDocType : DocTypeBase, new();
|
||||
|
||||
/// <summary>
|
||||
/// Loads the ancestors.
|
||||
/// </summary>
|
||||
/// <param name="startNodeId">The start node id.</param>
|
||||
/// <returns></returns>
|
||||
public abstract IEnumerable<DocTypeBase> LoadAncestors(int startNodeId);
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases unmanaged and - optionally - managed resources
|
||||
/// </summary>
|
||||
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
|
||||
protected internal virtual void Dispose(bool disposing)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{31CAEC36-0C3D-4D69-B092-84866811EA07}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>umbraco.Linq.Core</RootNamespace>
|
||||
<AssemblyName>umbraco.Linq.Core</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\umbraco.Linq.Core.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug - Fixed Version|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug - Fixed Version\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>bin\Debug\Umbraco.Linq.Core.XML</DocumentationFile>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Solution Items\SolutionInfo.cs">
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AssociationTree.cs" />
|
||||
<Compile Include="Attributes.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="ITree.cs" />
|
||||
<Compile Include="UmbracoDataProvider.cs" />
|
||||
<Compile Include="Node\NodeAssociationTree.cs" />
|
||||
<Compile Include="Node\NodeTree.cs" />
|
||||
<Compile Include="Node\NodeDataProvider.cs" />
|
||||
<Compile Include="Tree.cs" />
|
||||
<Compile Include="UmbracoDataContext.cs" />
|
||||
<Compile Include="DocTypeBase.cs" />
|
||||
<Compile Include="Exceptions.cs" />
|
||||
<Compile Include="ReflectionAssistance.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Switch.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\..\..\dep\Schemas\UmbracoConfig.xsd">
|
||||
<Link>Node\UmbracoConfig.xsd</Link>
|
||||
</EmbeddedResource>
|
||||
<None Include="CoreClasses.cd" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\umbraco\businesslogic\umbraco.businesslogic.csproj">
|
||||
<Project>{E469A9CE-1BEC-423F-AC44-713CD72457EA}</Project>
|
||||
<Name>umbraco.businesslogic</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{4872D945-97E8-4C30-8EDC-64E424645979}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Umbraco.Linq.DTMetal.CodeBuilder.Installer</RootNamespace>
|
||||
<AssemblyName>Umbraco.Linq.DTMetal.CodeBuilder.Installer</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\Solution Items\umbraco-key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Solution Items\SolutionInfo.cs">
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="InstallerHandler.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="InstallerProgress.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="InstallerProgress.Designer.cs">
|
||||
<DependentUpon>InstallerProgress.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="InstallerProgress.resx">
|
||||
<DependentUpon>InstallerProgress.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Item packages\LINQtoUmbracoCS.zip" />
|
||||
<Content Include="Item packages\LINQtoUmbracoVB.zip" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Solution Items\umbraco-key.snk">
|
||||
<Link>Properties\umbraco-key.snk</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DTMetal.CodeBuilder\DTMetal.CodeBuilder.csproj">
|
||||
<Project>{461089E7-008E-4737-BA17-E1FCD1CC3D0E}</Project>
|
||||
<Name>DTMetal.CodeBuilder</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.ComponentModel;
|
||||
using Microsoft.Win32;
|
||||
using System.Windows.Forms;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Umbraco.Linq.DTMetal.CodeBuilder.Installer
|
||||
{
|
||||
[RunInstaller(true)]
|
||||
public class InstallerHandler : System.Configuration.Install.Installer
|
||||
{
|
||||
public override void Install(System.Collections.IDictionary stateSaver)
|
||||
{
|
||||
base.Install(stateSaver);
|
||||
|
||||
var vsPath = GetVsPath();
|
||||
var targetPath = Context.Parameters["TargetDir"];
|
||||
|
||||
if (vsPath != null && targetPath != null)
|
||||
{
|
||||
var progress = new InstallerProgress(InstallMode.Install, vsPath, targetPath);
|
||||
MessageBoxOptions options = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ? MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading : 0;
|
||||
if (progress.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
MessageBox.Show("VS 2008 Setup Failed", "LINQ to Umbraco Setup", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, options);
|
||||
MessageBox.Show(progress.Error.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetVsPath()
|
||||
{
|
||||
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0", false);
|
||||
if (key != null)
|
||||
return (string)key.GetValue("InstallDir");
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Uninstall(System.Collections.IDictionary savedState)
|
||||
{
|
||||
base.Uninstall(savedState);
|
||||
|
||||
var vsPath = GetVsPath();
|
||||
if (vsPath != null)
|
||||
{
|
||||
var progress = new InstallerProgress(InstallMode.Uninstall, vsPath, null);
|
||||
progress.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+84
@@ -0,0 +1,84 @@
|
||||
namespace Umbraco.Linq.DTMetal.CodeBuilder.Installer
|
||||
{
|
||||
partial class InstallerProgress
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallerProgress));
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.installWorker = new System.ComponentModel.BackgroundWorker();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
resources.ApplyResources(this.progressBar1, "progressBar1");
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
||||
//
|
||||
// installWorker
|
||||
//
|
||||
this.installWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.installWorker_DoWork);
|
||||
this.installWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.installWorker_RunWorkerCompleted);
|
||||
//
|
||||
// InstallerProgress
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "InstallerProgress";
|
||||
this.Load += new System.EventHandler(this.InstallerProgress_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.ComponentModel.BackgroundWorker installWorker;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Globalization;
|
||||
using Microsoft.Win32;
|
||||
using System.Linq;
|
||||
|
||||
namespace Umbraco.Linq.DTMetal.CodeBuilder.Installer
|
||||
{
|
||||
public partial class InstallerProgress : Form
|
||||
{
|
||||
private const string generatorKey = "{52B316AA-1997-4c81-9969-95404C09EEB4}";
|
||||
private const string dtml = ".dtml";
|
||||
private const string clas = "LINQtoUmbraco.DTML.1.0";
|
||||
private const string desc = "LINQ to Umbraco Entity Mapping";
|
||||
|
||||
private InstallMode _mode;
|
||||
private string _vsPath;
|
||||
private string _targetPath;
|
||||
|
||||
public InstallerProgress(InstallMode mode, string vsPath, string targetPath)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_mode = mode;
|
||||
_vsPath = vsPath;
|
||||
_targetPath = targetPath;
|
||||
}
|
||||
|
||||
#region Events
|
||||
private void installWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
|
||||
switch (_mode)
|
||||
{
|
||||
case InstallMode.Install:
|
||||
InstallVsTemplates();
|
||||
SetupRegistry();
|
||||
InstallDtmlXsd();
|
||||
ConfigVs();
|
||||
break;
|
||||
case InstallMode.Uninstall:
|
||||
UninstallVsTemplates();
|
||||
TearDownRegistry();
|
||||
UninstallDtmlXsd();
|
||||
ConfigVs();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void installWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Error != null)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Error = e.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
public Exception Error { get; set; }
|
||||
|
||||
private void InstallerProgress_Load(object sender, EventArgs e)
|
||||
{
|
||||
installWorker.RunWorkerAsync();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Uninstall
|
||||
private void UninstallDtmlXsd()
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(GetDtmlXsdPath());
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void TearDownRegistry()
|
||||
{
|
||||
if(Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey) != null)
|
||||
{
|
||||
Registry.LocalMachine.DeleteSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey);
|
||||
}
|
||||
|
||||
if (Registry.ClassesRoot.OpenSubKey(dtml) != null)
|
||||
{
|
||||
Registry.ClassesRoot.DeleteSubKeyTree(dtml);
|
||||
}
|
||||
|
||||
if (Registry.ClassesRoot.OpenSubKey(clas) != null)
|
||||
{
|
||||
Registry.ClassesRoot.DeleteSubKeyTree(clas);
|
||||
}
|
||||
}
|
||||
|
||||
private void UninstallVsTemplates()
|
||||
{
|
||||
string csTgt = Path.Combine(_vsPath, @"ItemTemplates\CSharp\1033\LINQtoUmbracoCS.zip");
|
||||
string vbTgt = Path.Combine(_vsPath, @"ItemTemplates\VisualBasic\1033\LINQtoUmbracoVB.zip");
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(csTgt);
|
||||
File.Delete(vbTgt);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Install
|
||||
private void InstallDtmlXsd()
|
||||
{
|
||||
//string assemblyName = GetCodeBuilderAssemblyName();
|
||||
//Assembly assembly = Assembly.Load(assemblyName);
|
||||
|
||||
//it seems that it runs this before the GAC is deployed, so the above code deosn't work
|
||||
//I have to embed the XSD in this assembly instead
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
|
||||
// Load the XSD for DocTypeML.
|
||||
string xsd;
|
||||
using (Stream s = ClassGenerator.GetXsd())
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(s))
|
||||
{
|
||||
xsd = sr.ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
// Write the XSD to the Visual Studio folder with XML schemas.
|
||||
using (StreamWriter sw = File.CreateText(GetDtmlXsdPath()))
|
||||
{
|
||||
sw.Write(xsd);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupRegistry()
|
||||
{
|
||||
#region LINQtoUmbracoGenerator Key
|
||||
RegistryKey genKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey);
|
||||
genKey.SetValue("Assembly", GetCodeBuilderAssemblyName()); //full name of the assembly which the generator is in
|
||||
genKey.SetValue("Class", "Umbraco.Linq.DTMetal.CodeBuilder.LINQtoUmbracoGenerator"); //generator class
|
||||
genKey.SetValue("InprocServer32", Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), @"system32\mscoree.dll"));
|
||||
genKey.SetValue("ThreadingModel", "Both");
|
||||
genKey.Close();
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\.dtml
|
||||
{
|
||||
RegistryKey dtmlKey = Registry.ClassesRoot.CreateSubKey(dtml, RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||
dtmlKey.SetValue(null, clas);
|
||||
dtmlKey.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0
|
||||
{
|
||||
RegistryKey kClas = Registry.ClassesRoot.CreateSubKey(clas, RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||
kClas.SetValue(null, desc);
|
||||
kClas.SetValue("AlwaysShowExt", "1");
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\DefaultIcon
|
||||
{
|
||||
RegistryKey kIcon = kClas.CreateSubKey("DefaultIcon");
|
||||
kIcon.SetValue(null, Path.Combine(_targetPath, @"DTMetal.exe") + ",0");
|
||||
kIcon.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell
|
||||
{
|
||||
RegistryKey kShel = kClas.CreateSubKey("shell");
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open
|
||||
{
|
||||
RegistryKey kOpen = kShel.CreateSubKey("Open");
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open\Command
|
||||
{
|
||||
RegistryKey kComm = kOpen.CreateSubKey("Command");
|
||||
kComm.SetValue(null, "\"" + Path.Combine(_vsPath, "devenv.exe") + "\" /dde \"%1\"");
|
||||
kComm.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open\ddeexec
|
||||
{
|
||||
RegistryKey kDdex = kOpen.CreateSubKey("ddeexec");
|
||||
kDdex.SetValue(null, "Open(\"%1\")");
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open\ddeexec\Application
|
||||
{
|
||||
RegistryKey kAppn = kDdex.CreateSubKey("Application");
|
||||
kAppn.SetValue(null, "VisualStudio.9.0");
|
||||
kAppn.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoUmbraco.DTML.1.0\shell\Open\ddeexec\Topic
|
||||
{
|
||||
RegistryKey kTopc = kDdex.CreateSubKey("Topic");
|
||||
kTopc.SetValue(null, "system");
|
||||
kTopc.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
kDdex.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
kOpen.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
kShel.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
kClas.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private void InstallVsTemplates()
|
||||
{
|
||||
string csSrc = Path.Combine(_targetPath, @"Item packages\LINQtoUmbracoCS.zip");
|
||||
string vbSrc = Path.Combine(_targetPath, @"Item packages\LINQtoUmbracoVB.zip");
|
||||
string csTgt = Path.Combine(_vsPath, @"ItemTemplates\CSharp\1033\LINQtoUmbracoCS.zip");
|
||||
string vbTgt = Path.Combine(_vsPath, @"ItemTemplates\VisualBasic\1033\LINQtoUmbracoVB.zip");
|
||||
|
||||
if (!File.Exists(csTgt))
|
||||
File.Copy(csSrc, csTgt);
|
||||
if (!File.Exists(vbTgt))
|
||||
File.Copy(vbSrc, vbTgt);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private static string GetCodeBuilderAssemblyName()
|
||||
{
|
||||
//get the assembly version info
|
||||
AssemblyName current = Assembly.GetExecutingAssembly().GetName();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (byte b in current.GetPublicKeyToken())
|
||||
sb.AppendFormat("{0:x2}", b);
|
||||
|
||||
string publicKeyToken = sb.ToString();
|
||||
string version = current.Version.ToString();
|
||||
|
||||
return String.Format(CultureInfo.InvariantCulture, "Umbraco.Linq.DTMetal.CodeBuilder, Version={0}, Culture=neutral, PublicKeyToken={1}", version, publicKeyToken);
|
||||
}
|
||||
|
||||
private string GetDtmlXsdPath()
|
||||
{
|
||||
string path = _vsPath; //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\
|
||||
path = path.TrimEnd('\\'); //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE
|
||||
path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7
|
||||
path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 9.0
|
||||
path = Path.Combine(path, "Xml"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml
|
||||
path = Path.Combine(path, "Schemas"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas
|
||||
path = Path.Combine(path, "DocTypeML.xsd"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas\DocTypeML.xsd
|
||||
return path;
|
||||
}
|
||||
|
||||
private void ConfigVs()
|
||||
{
|
||||
string devenv = Path.Combine(_vsPath, "devenv.exe");
|
||||
Process p = Process.Start(devenv, "/InstallVSTemplates");
|
||||
p.WaitForExit();
|
||||
}
|
||||
}
|
||||
|
||||
public enum InstallMode
|
||||
{
|
||||
Install,
|
||||
Uninstall
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>13, 13</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>246, 13</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="label1.Text" xml:space="preserve">
|
||||
<value>LINQ to Umbraco is configuring Visual Studio 2008</value>
|
||||
</data>
|
||||
<data name=">>label1.Name" xml:space="preserve">
|
||||
<value>label1</value>
|
||||
</data>
|
||||
<data name=">>label1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>25, 30</value>
|
||||
</data>
|
||||
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>221, 13</value>
|
||||
</data>
|
||||
<data name="label2.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label2.Text" xml:space="preserve">
|
||||
<value>This may take a few minutes, please stand by</value>
|
||||
</data>
|
||||
<data name=">>label2.Name" xml:space="preserve">
|
||||
<value>label2</value>
|
||||
</data>
|
||||
<data name=">>label2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label2.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label2.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="progressBar1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 61</value>
|
||||
</data>
|
||||
<data name="progressBar1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>243, 27</value>
|
||||
</data>
|
||||
<data name="progressBar1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name=">>progressBar1.Name" xml:space="preserve">
|
||||
<value>progressBar1</value>
|
||||
</data>
|
||||
<data name=">>progressBar1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ProgressBar, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>progressBar1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>progressBar1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="installWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>275, 100</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterParent</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>LINQ to Umbraco Installer Progress</value>
|
||||
</data>
|
||||
<data name=">>installWorker.Name" xml:space="preserve">
|
||||
<value>installWorker</value>
|
||||
</data>
|
||||
<data name=">>installWorker.Type" xml:space="preserve">
|
||||
<value>System.ComponentModel.BackgroundWorker, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>InstallerProgress</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
Binary file not shown.
+31
@@ -0,0 +1,31 @@
|
||||
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
|
||||
<TemplateData>
|
||||
<Name>LINQ to Umbraco File</Name>
|
||||
<Description>An empty LINQ to Umbraco file</Description>
|
||||
<Icon>umbraco.ico</Icon>
|
||||
<ProjectType>CSharp</ProjectType>
|
||||
<SortOrder>100</SortOrder>
|
||||
<DefaultName>DataClasses.dtml</DefaultName>
|
||||
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
|
||||
<TemplateID>Umbraco.Linq.Core.Designer</TemplateID>
|
||||
<RequiredFrameworkVersion>3.5</RequiredFrameworkVersion>
|
||||
</TemplateData>
|
||||
<TemplateContent>
|
||||
<References>
|
||||
<Reference>
|
||||
<Assembly>System</Assembly>
|
||||
</Reference>
|
||||
<Reference>
|
||||
<Assembly>System.Core</Assembly>
|
||||
</Reference>
|
||||
<Reference>
|
||||
<Assembly>Umbraco.Linq.Core</Assembly>
|
||||
</Reference>
|
||||
</References>
|
||||
<ProjectItem TargetFileName="$fileinputname$.dtml" ReplaceParameters="true">dtml.dtml</ProjectItem>
|
||||
<CustomParameters>
|
||||
<CustomParameter Name="$CustomTool$" Value="LINQtoUmbracoGenerator" />
|
||||
<CustomParameter Name="$Namespace$" Value="$rootnamespace$" />
|
||||
</CustomParameters>
|
||||
</TemplateContent>
|
||||
</VSTemplate>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
<auto-generated>
|
||||
This code was generated by a tool.
|
||||
LINQ to Umbraco Version: $version$
|
||||
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</auto-generated>
|
||||
-->
|
||||
|
||||
<DocumentTypes Serialization="Unidirectional" DataContextName="$fileinputname$" PluralizeCollections="true">
|
||||
|
||||
</DocumentTypes>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
BIN
Binary file not shown.
+31
@@ -0,0 +1,31 @@
|
||||
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
|
||||
<TemplateData>
|
||||
<Name>LINQ to Umbraco File</Name>
|
||||
<Description>An empty LINQ to Umbraco file</Description>
|
||||
<Icon>umbraco.ico</Icon>
|
||||
<ProjectType>VisualBasic</ProjectType>
|
||||
<SortOrder>100</SortOrder>
|
||||
<DefaultName>DataClasses.dtml</DefaultName>
|
||||
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
|
||||
<TemplateID>Umbraco.Linq.Core.Designer</TemplateID>
|
||||
<RequiredFrameworkVersion>3.5</RequiredFrameworkVersion>
|
||||
</TemplateData>
|
||||
<TemplateContent>
|
||||
<References>
|
||||
<Reference>
|
||||
<Assembly>System</Assembly>
|
||||
</Reference>
|
||||
<Reference>
|
||||
<Assembly>System.Core</Assembly>
|
||||
</Reference>
|
||||
<Reference>
|
||||
<Assembly>Umbraco.Linq.Core</Assembly>
|
||||
</Reference>
|
||||
</References>
|
||||
<ProjectItem TargetFileName="$fileinputname$.dtml" ReplaceParameters="true">dtml.dtml</ProjectItem>
|
||||
<CustomParameters>
|
||||
<CustomParameter Name="$CustomTool$" Value="LINQtoUmbracoGenerator" />
|
||||
<CustomParameter Name="$Namespace$" Value="$rootnamespace$" />
|
||||
</CustomParameters>
|
||||
</TemplateContent>
|
||||
</VSTemplate>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
<auto-generated>
|
||||
This code was generated by a tool.
|
||||
LINQ to Umbraco Version: $version$
|
||||
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</auto-generated>
|
||||
-->
|
||||
|
||||
<DocumentTypes Serialization="Unidirectional" DataContextName="$fileinputname$" PluralizeCollections="true">
|
||||
|
||||
</DocumentTypes>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
+9
@@ -0,0 +1,9 @@
|
||||
using System.Reflection;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("DTMetal.CodeBuilder.Installer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("DTMetal.CodeBuilder.Installer")]
|
||||
@@ -0,0 +1,185 @@
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
This code is licensed under the Visual Studio SDK license terms.
|
||||
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// A managed wrapper for VS's concept of an IVsSingleFileGenerator which is
|
||||
/// a custom tool invoked at design time which can take any file as an input
|
||||
/// and provide any file as output.
|
||||
/// </summary>
|
||||
public abstract class BaseCodeGenerator : IVsSingleFileGenerator
|
||||
{
|
||||
private IVsGeneratorProgress codeGeneratorProgress;
|
||||
private string codeFileNameSpace = String.Empty;
|
||||
private string codeFilePath = String.Empty;
|
||||
|
||||
#region IVsSingleFileGenerator Members
|
||||
|
||||
/// <summary>
|
||||
/// Implements the IVsSingleFileGenerator.DefaultExtension method.
|
||||
/// Returns the extension of the generated file
|
||||
/// </summary>
|
||||
/// <param name="pbstrDefaultExtension">Out parameter, will hold the extension that is to be given to the output file name. The returned extension must include a leading period</param>
|
||||
/// <returns>S_OK if successful, E_FAIL if not</returns>
|
||||
int IVsSingleFileGenerator.DefaultExtension(out string pbstrDefaultExtension)
|
||||
{
|
||||
try
|
||||
{
|
||||
pbstrDefaultExtension = GetDefaultExtension();
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Trace.WriteLine(Strings.GetDefaultExtensionFailed);
|
||||
Trace.WriteLine(e.ToString());
|
||||
pbstrDefaultExtension = string.Empty;
|
||||
return VSConstants.E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements the IVsSingleFileGenerator.Generate method.
|
||||
/// Executes the transformation and returns the newly generated output file, whenever a custom tool is loaded, or the input file is saved
|
||||
/// </summary>
|
||||
/// <param name="wszInputFilePath">The full path of the input file. May be a null reference (Nothing in Visual Basic) in future releases of Visual Studio, so generators should not rely on this value</param>
|
||||
/// <param name="bstrInputFileContents">The contents of the input file. This is either a UNICODE BSTR (if the input file is text) or a binary BSTR (if the input file is binary). If the input file is a text file, the project system automatically converts the BSTR to UNICODE</param>
|
||||
/// <param name="wszDefaultNamespace">This parameter is meaningful only for custom tools that generate code. It represents the namespace into which the generated code will be placed. If the parameter is not a null reference (Nothing in Visual Basic) and not empty, the custom tool can use the following syntax to enclose the generated code</param>
|
||||
/// <param name="rgbOutputFileContents">[out] Returns an array of bytes to be written to the generated file. You must include UNICODE or UTF-8 signature bytes in the returned byte array, as this is a raw stream. The memory for rgbOutputFileContents must be allocated using the .NET Framework call, System.Runtime.InteropServices.AllocCoTaskMem, or the equivalent Win32 system call, CoTaskMemAlloc. The project system is responsible for freeing this memory</param>
|
||||
/// <param name="pcbOutput">[out] Returns the count of bytes in the rgbOutputFileContent array</param>
|
||||
/// <param name="pGenerateProgress">A reference to the IVsGeneratorProgress interface through which the generator can report its progress to the project system</param>
|
||||
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns E_FAIL</returns>
|
||||
int IVsSingleFileGenerator.Generate(string wszInputFilePath, string bstrInputFileContents, string wszDefaultNamespace, IntPtr[] rgbOutputFileContents, out uint pcbOutput, IVsGeneratorProgress pGenerateProgress)
|
||||
{
|
||||
if (bstrInputFileContents == null)
|
||||
{
|
||||
throw new ArgumentNullException(bstrInputFileContents);
|
||||
}
|
||||
|
||||
codeFilePath = wszInputFilePath;
|
||||
codeFileNameSpace = wszDefaultNamespace;
|
||||
codeGeneratorProgress = pGenerateProgress;
|
||||
|
||||
byte[] bytes = GenerateCode(bstrInputFileContents);
|
||||
|
||||
if (bytes == null)
|
||||
{
|
||||
// This signals that GenerateCode() has failed. Tasklist items have been put up in GenerateCode()
|
||||
rgbOutputFileContents = null;
|
||||
pcbOutput = 0;
|
||||
|
||||
// Return E_FAIL to inform Visual Studio that the generator has failed (so that no file gets generated)
|
||||
return VSConstants.E_FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The contract between IVsSingleFileGenerator implementors and consumers is that
|
||||
// any output returned from IVsSingleFileGenerator.Generate() is returned through
|
||||
// memory allocated via CoTaskMemAlloc(). Therefore, we have to convert the
|
||||
// byte[] array returned from GenerateCode() into an unmanaged blob.
|
||||
|
||||
int outputLength = bytes.Length;
|
||||
rgbOutputFileContents[0] = Marshal.AllocCoTaskMem(outputLength);
|
||||
Marshal.Copy(bytes, 0, rgbOutputFileContents[0], outputLength);
|
||||
pcbOutput = (uint)outputLength;
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Namespace for the file
|
||||
/// </summary>
|
||||
protected string FileNameSpace
|
||||
{
|
||||
get
|
||||
{
|
||||
return codeFileNameSpace;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// File-path for the input file
|
||||
/// </summary>
|
||||
protected string InputFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return codeFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interface to the VS shell object we use to tell our progress while we are generating
|
||||
/// </summary>
|
||||
internal IVsGeneratorProgress CodeGeneratorProgress
|
||||
{
|
||||
get
|
||||
{
|
||||
return codeGeneratorProgress;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default extension for this generator
|
||||
/// </summary>
|
||||
/// <returns>String with the default extension for this generator</returns>
|
||||
protected abstract string GetDefaultExtension();
|
||||
|
||||
/// <summary>
|
||||
/// The method that does the actual work of generating code given the input file
|
||||
/// </summary>
|
||||
/// <param name="inputFileContent">File contents as a string</param>
|
||||
/// <returns>The generated code file as a byte-array</returns>
|
||||
protected abstract byte[] GenerateCode(string inputFileContent);
|
||||
|
||||
/// <summary>
|
||||
/// Method that will communicate an error via the shell callback mechanism
|
||||
/// </summary>
|
||||
/// <param name="level">Level or severity</param>
|
||||
/// <param name="message">Text displayed to the user</param>
|
||||
/// <param name="line">Line number of error</param>
|
||||
/// <param name="column">Column number of error</param>
|
||||
protected virtual void GeneratorError(uint level, string message, uint line, uint column)
|
||||
{
|
||||
IVsGeneratorProgress progress = CodeGeneratorProgress;
|
||||
if (progress != null)
|
||||
{
|
||||
progress.GeneratorError(0, level, message, line, column);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method that will communicate a warning via the shell callback mechanism
|
||||
/// </summary>
|
||||
/// <param name="level">Level or severity</param>
|
||||
/// <param name="message">Text displayed to the user</param>
|
||||
/// <param name="line">Line number of warning</param>
|
||||
/// <param name="column">Column number of warning</param>
|
||||
protected virtual void GeneratorWarning(uint level, string message, uint line, uint column)
|
||||
{
|
||||
IVsGeneratorProgress progress = CodeGeneratorProgress;
|
||||
if (progress != null)
|
||||
{
|
||||
progress.GeneratorError(1, level, message, line, column);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+199
@@ -0,0 +1,199 @@
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
This code is licensed under the Visual Studio SDK license terms.
|
||||
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using EnvDTE;
|
||||
using EnvDTE80;
|
||||
using VSLangProj;
|
||||
using VSOLE = Microsoft.VisualStudio.OLE.Interop;
|
||||
using Microsoft.VisualStudio;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.Designer.Interfaces;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// Base code generator with site implementation
|
||||
/// </summary>
|
||||
public abstract class BaseCodeGeneratorWithSite : BaseCodeGenerator, VSOLE.IObjectWithSite
|
||||
{
|
||||
private object site = null;
|
||||
private CodeDomProvider codeDomProvider = null;
|
||||
private ServiceProvider serviceProvider = null;
|
||||
|
||||
#region IObjectWithSite Members
|
||||
|
||||
/// <summary>
|
||||
/// GetSite method of IOleObjectWithSite
|
||||
/// </summary>
|
||||
/// <param name="riid">interface to get</param>
|
||||
/// <param name="ppvSite">IntPtr in which to stuff return value</param>
|
||||
void VSOLE.IObjectWithSite.GetSite(ref Guid riid, out IntPtr ppvSite)
|
||||
{
|
||||
if (site == null)
|
||||
{
|
||||
throw new COMException("object is not sited", VSConstants.E_FAIL);
|
||||
}
|
||||
|
||||
IntPtr pUnknownPointer = Marshal.GetIUnknownForObject(site);
|
||||
IntPtr intPointer = IntPtr.Zero;
|
||||
Marshal.QueryInterface(pUnknownPointer, ref riid, out intPointer);
|
||||
|
||||
if (intPointer == IntPtr.Zero)
|
||||
{
|
||||
throw new COMException("site does not support requested interface", VSConstants.E_NOINTERFACE);
|
||||
}
|
||||
|
||||
ppvSite = intPointer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetSite method of IOleObjectWithSite
|
||||
/// </summary>
|
||||
/// <param name="pUnkSite">site for this object to use</param>
|
||||
void VSOLE.IObjectWithSite.SetSite(object pUnkSite)
|
||||
{
|
||||
site = pUnkSite;
|
||||
codeDomProvider = null;
|
||||
serviceProvider = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Demand-creates a ServiceProvider
|
||||
/// </summary>
|
||||
private ServiceProvider SiteServiceProvider
|
||||
{
|
||||
get
|
||||
{
|
||||
if (serviceProvider == null)
|
||||
{
|
||||
serviceProvider = new ServiceProvider(site as VSOLE.IServiceProvider);
|
||||
Debug.Assert(serviceProvider != null, "Unable to get ServiceProvider from site object.");
|
||||
}
|
||||
return serviceProvider;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method to get a service by its GUID
|
||||
/// </summary>
|
||||
/// <param name="serviceGuid">GUID of service to retrieve</param>
|
||||
/// <returns>An object that implements the requested service</returns>
|
||||
protected object GetService(Guid serviceGuid)
|
||||
{
|
||||
return SiteServiceProvider.GetService(serviceGuid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method to get a service by its Type
|
||||
/// </summary>
|
||||
/// <param name="serviceType">Type of service to retrieve</param>
|
||||
/// <returns>An object that implements the requested service</returns>
|
||||
protected object GetService(Type serviceType)
|
||||
{
|
||||
return SiteServiceProvider.GetService(serviceType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a CodeDomProvider object for the language of the project containing
|
||||
/// the project item the generator was called on
|
||||
/// </summary>
|
||||
/// <returns>A CodeDomProvider object</returns>
|
||||
protected virtual CodeDomProvider GetCodeProvider()
|
||||
{
|
||||
if (codeDomProvider == null)
|
||||
{
|
||||
//Query for IVSMDCodeDomProvider/SVSMDCodeDomProvider for this project type
|
||||
IVSMDCodeDomProvider provider = GetService(typeof(SVSMDCodeDomProvider)) as IVSMDCodeDomProvider;
|
||||
if (provider != null)
|
||||
{
|
||||
codeDomProvider = provider.CodeDomProvider as CodeDomProvider;
|
||||
}
|
||||
else
|
||||
{
|
||||
//In the case where no language specific CodeDom is available, fall back to C#
|
||||
codeDomProvider = CodeDomProvider.CreateProvider("C#");
|
||||
}
|
||||
}
|
||||
return codeDomProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default extension of the output file from the CodeDomProvider
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected override string GetDefaultExtension()
|
||||
{
|
||||
CodeDomProvider codeDom = GetCodeProvider();
|
||||
Debug.Assert(codeDom != null, "CodeDomProvider is NULL.");
|
||||
string extension = codeDom.FileExtension;
|
||||
if (extension != null && extension.Length > 0)
|
||||
{
|
||||
extension = "." + extension.TrimStart(".".ToCharArray());
|
||||
}
|
||||
return extension;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the EnvDTE.ProjectItem object that corresponds to the project item the code
|
||||
/// generator was called on
|
||||
/// </summary>
|
||||
/// <returns>The EnvDTE.ProjectItem of the project item the code generator was called on</returns>
|
||||
protected ProjectItem GetProjectItem()
|
||||
{
|
||||
object p = GetService(typeof(ProjectItem));
|
||||
Debug.Assert(p != null, "Unable to get Project Item.");
|
||||
return (ProjectItem)p;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the EnvDTE.Project object of the project containing the project item the code
|
||||
/// generator was called on
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The EnvDTE.Project object of the project containing the project item the code generator was called on
|
||||
/// </returns>
|
||||
protected Project GetProject()
|
||||
{
|
||||
return GetProjectItem().ContainingProject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the VSLangProj.VSProjectItem object that corresponds to the project item the code
|
||||
/// generator was called on
|
||||
/// </summary>
|
||||
/// <returns>The VSLangProj.VSProjectItem of the project item the code generator was called on</returns>
|
||||
protected VSProjectItem GetVSProjectItem()
|
||||
{
|
||||
return (VSProjectItem)GetProjectItem().Object;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the VSLangProj.VSProject object of the project containing the project item the code
|
||||
/// generator was called on
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The VSLangProj.VSProject object of the project containing the project item
|
||||
/// the code generator was called on
|
||||
/// </returns>
|
||||
protected VSProject GetVSProject()
|
||||
{
|
||||
return (VSProject)GetProject().Object;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="umbraco.Linq.DTMetal.CodeBuilder.DtmlCodeGenerator">
|
||||
<Position X="7" Y="3" Width="2.25" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAIAAAAAAAgAAAEAAAAAAAAAAACAAA=</HashCode>
|
||||
<FileName>DtmlCodeGenerator.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.DTMetal.CodeBuilder.BaseCodeGenerator">
|
||||
<Position X="0.5" Y="3" Width="2.75" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAABAAAAAAAAAIAAQAIAAEAAAAMABAABAAABACAIA=</HashCode>
|
||||
<FileName>BaseCodeGenerator.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="umbraco.Linq.DTMetal.CodeBuilder.BaseCodeGeneratorWithSite">
|
||||
<Position X="4" Y="3" Width="2.25" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAABAAAAAQQAAAIAAAAAAQAAFACAABgAAAEACAEA=</HashCode>
|
||||
<FileName>BaseCodeGeneratorWithSite.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Font Name="Tahoma" Size="8.25" />
|
||||
</ClassDiagram>
|
||||
@@ -0,0 +1,724 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.CodeDom;
|
||||
using System.Runtime.Serialization;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Schema;
|
||||
using Microsoft.VisualBasic;
|
||||
using Microsoft.CSharp;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using umbraco.Linq.DTMetal.CodeBuilder.DataType;
|
||||
using VB = Microsoft.VisualBasic;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder
|
||||
{
|
||||
public enum GenerationLanguage
|
||||
{
|
||||
CSharp,
|
||||
VB
|
||||
}
|
||||
|
||||
internal enum SerializationMode
|
||||
{
|
||||
None, Unidirectional
|
||||
}
|
||||
|
||||
internal sealed class ClassGeneratorArgs
|
||||
{
|
||||
public string Namespace { get; set; }
|
||||
public CodeDomProvider Provider { get; set; }
|
||||
public string DtmlPath { get; set; }
|
||||
public XDocument Dtml { get; set; }
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
|
||||
public sealed class ClassGenerator
|
||||
{
|
||||
internal ClassGeneratorArgs Args { get; set; }
|
||||
internal bool PluralizeCollections { get; set; }
|
||||
internal SerializationMode SerializationMode { get; set; }
|
||||
private CodeCompileUnit Code { get; set; }
|
||||
|
||||
internal bool IsCSharpCodeProvider()
|
||||
{
|
||||
return (string.Compare(this.Args.Provider.FileExtension, "CS", StringComparison.OrdinalIgnoreCase) == 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new CodeBuilder.
|
||||
/// </summary>
|
||||
/// <param name="xmlPath">The path to the DTML file</param>
|
||||
/// <param name="lang">The language to generate with.</param>
|
||||
/// <returns></returns>
|
||||
public static ClassGenerator CreateBuilder(string xmlPath, string ns, GenerationLanguage lang)
|
||||
{
|
||||
var args = new ClassGeneratorArgs()
|
||||
{
|
||||
DtmlPath = xmlPath,
|
||||
Namespace = ns
|
||||
};
|
||||
switch (lang)
|
||||
{
|
||||
case GenerationLanguage.VB:
|
||||
args.Provider = new VBCodeProvider();
|
||||
break;
|
||||
|
||||
case GenerationLanguage.CSharp:
|
||||
default:
|
||||
args.Provider = new CSharpCodeProvider();
|
||||
break;
|
||||
}
|
||||
|
||||
return new ClassGenerator(args);
|
||||
}
|
||||
|
||||
internal ClassGenerator(ClassGeneratorArgs args)
|
||||
{
|
||||
this.Args = args;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
if (this.Code == null)
|
||||
{
|
||||
this.GenerateCode();
|
||||
}
|
||||
|
||||
var dtml = new FileInfo(this.Args.DtmlPath);
|
||||
|
||||
CodeGeneratorOptions options = new CodeGeneratorOptions();
|
||||
options.BracingStyle = "C";
|
||||
using (StreamWriter sourceWriter = new StreamWriter(dtml.FullName.Replace("dtml", "designer." + this.Args.Provider.FileExtension)))
|
||||
{
|
||||
this.Args.Provider.GenerateCodeFromCompileUnit(this.Code, sourceWriter, options);
|
||||
}
|
||||
}
|
||||
|
||||
internal byte[] SaveForVs()
|
||||
{
|
||||
if (this.Code == null)
|
||||
{
|
||||
this.GenerateCode();
|
||||
}
|
||||
|
||||
CodeGeneratorOptions options = new CodeGeneratorOptions();
|
||||
options.BracingStyle = "C";
|
||||
|
||||
StringBuilder code = new StringBuilder();
|
||||
TextWriter tw = new StringWriter(code, CultureInfo.InvariantCulture);
|
||||
this.Args.Provider.GenerateCodeFromCompileUnit(this.Code, tw, null);
|
||||
tw.Flush();
|
||||
|
||||
Encoding enc = Encoding.GetEncoding(tw.Encoding.WindowsCodePage);
|
||||
byte[] preamble = enc.GetPreamble();
|
||||
int preambleLength = preamble.Length;
|
||||
byte[] body = enc.GetBytes(code.ToString());
|
||||
Array.Resize<byte>(ref preamble, preambleLength + body.Length);
|
||||
Array.Copy(body, 0, preamble, preambleLength, body.Length);
|
||||
|
||||
// Return generated code.
|
||||
return preamble;
|
||||
}
|
||||
|
||||
public void GenerateCode()
|
||||
{
|
||||
if (Args == null)
|
||||
{
|
||||
throw new ArgumentNullException("Args");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.Args.DtmlPath))
|
||||
{
|
||||
var dtml = new FileInfo(this.Args.DtmlPath);
|
||||
if (!dtml.Exists)
|
||||
{
|
||||
throw new FileNotFoundException(String.Format(Strings.DtmlNotFound, this.Args.DtmlPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Args.Dtml = XDocument.Load(this.Args.DtmlPath);
|
||||
}
|
||||
}
|
||||
|
||||
ValidateSchema();
|
||||
|
||||
this.PluralizeCollections = (bool)this.Args.Dtml.Root.Attribute("PluralizeCollections");
|
||||
this.SerializationMode = (SerializationMode)Enum.Parse(typeof(SerializationMode), (string)this.Args.Dtml.Root.Attribute("Serialization"));
|
||||
|
||||
IEnumerable<DocType> docTypes = XmlToClasses(this.Args.Dtml);
|
||||
|
||||
this.Code = new CodeCompileUnit();
|
||||
CodeNamespace ns = GenerateNamespace(this.Args.Namespace);
|
||||
|
||||
CodeTypeDeclaration dataContext = CreateDataContext(this.Args.Dtml, docTypes);
|
||||
|
||||
ns.Types.Add(dataContext);
|
||||
|
||||
CreateDocTypes(docTypes, ns);
|
||||
|
||||
this.Code.Namespaces.Add(ns);
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
|
||||
private CodeTypeDeclaration CreateDataContext(XDocument dtmlXml, IEnumerable<DocType> docTypes)
|
||||
{
|
||||
string methodName = "OnCreated";
|
||||
CodeExpressionStatement statement = new CodeExpressionStatement(new CodeMethodInvokeExpression(null, methodName, new CodeExpression[0]));
|
||||
|
||||
string dataContextName = dtmlXml.Root.Attribute("DataContextName").Value;
|
||||
//ensure the naming is standard
|
||||
if (!dataContextName.ToUpper().Contains("DATACONTEXT"))
|
||||
{
|
||||
dataContextName += "DataContext";
|
||||
}
|
||||
CodeTypeDeclaration dataContext = new CodeTypeDeclaration(dataContextName);
|
||||
dataContext.BaseTypes.Add("umbracoDataContext");
|
||||
dataContext.IsClass = true;
|
||||
dataContext.IsPartial = true;
|
||||
|
||||
string partialOnCreated = string.Empty;
|
||||
if (IsCSharpCodeProvider())
|
||||
{
|
||||
partialOnCreated = " partial void " + methodName + "();\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
partialOnCreated = " Partial Private Void " + methodName + "()\r\nEnd Sub\r\n";
|
||||
}
|
||||
CodeSnippetTypeMember onCreated = new CodeSnippetTypeMember(partialOnCreated);
|
||||
CodeRegionDirective region = new CodeRegionDirective(CodeRegionMode.Start, "Partials");
|
||||
onCreated.StartDirectives.Add(region);
|
||||
onCreated.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, "Partials"));
|
||||
dataContext.Members.Add(onCreated);
|
||||
|
||||
//constructor with no arguments
|
||||
CodeConstructor ctor = new CodeConstructor();
|
||||
ctor.Attributes = MemberAttributes.Public;
|
||||
ctor.BaseConstructorArgs.Add(new CodePropertyReferenceExpression());
|
||||
ctor.Statements.Add(statement);
|
||||
dataContext.Members.Add(ctor);
|
||||
|
||||
//constructor that takes an umbracoDataProvider
|
||||
ctor = new CodeConstructor();
|
||||
ctor.Attributes = MemberAttributes.Public;
|
||||
ctor.Parameters.Add(new CodeParameterDeclarationExpression("umbracoDataProvider", "provider"));
|
||||
ctor.BaseConstructorArgs.Add(new CodePropertyReferenceExpression(null, "provider"));
|
||||
ctor.Statements.Add(statement);
|
||||
dataContext.Members.Add(ctor);
|
||||
|
||||
//Generate the Tree<TDocType> for each docType
|
||||
foreach (var dt in docTypes)
|
||||
{
|
||||
string name = dt.TypeName;
|
||||
if (this.PluralizeCollections)
|
||||
{
|
||||
name = PluraliseName(dt.TypeName);
|
||||
}
|
||||
var t = new CodeTypeReference("Tree");
|
||||
t.TypeArguments.Add(dt.TypeName);
|
||||
|
||||
CodeMemberProperty p = new CodeMemberProperty();
|
||||
p.Name = name;
|
||||
p.Type = t;
|
||||
p.Attributes = MemberAttributes.Public | MemberAttributes.Final;
|
||||
p.HasGet = true;
|
||||
p.HasSet = false;
|
||||
|
||||
p.GetStatements.Add(
|
||||
new CodeMethodReturnStatement(
|
||||
new CodeMethodInvokeExpression(
|
||||
new CodeMethodReferenceExpression(
|
||||
new CodeThisReferenceExpression(),
|
||||
"LoadTree",
|
||||
new CodeTypeReference[] {
|
||||
new CodeTypeReference(dt.TypeName)
|
||||
}),
|
||||
new CodeExpression[0])
|
||||
)
|
||||
);
|
||||
|
||||
dataContext.Members.Add(p);
|
||||
}
|
||||
return dataContext;
|
||||
}
|
||||
|
||||
internal IEnumerable<DocType> XmlToClasses(XDocument dtmlXml)
|
||||
{
|
||||
return dtmlXml.Descendants("DocumentType").Select(x => new DocType
|
||||
{
|
||||
Alias = (string)x.Element("Alias"),
|
||||
Description = (string)x.Element("Description"),
|
||||
Id = (int)x.Element("Id"),
|
||||
Name = (string)x.Element("Name"),
|
||||
ParentId = (int)x.Attribute("ParentId"),
|
||||
TypeName = Normalise((string)x.Element("Alias")),
|
||||
Properties = x.Descendants("Property").Select(p => new DocTypeProperty
|
||||
{
|
||||
Alias = (string)p.Element("Alias"),
|
||||
ControlId = new Guid((string)p.Element("ControlId")),
|
||||
DatabaseType = Type.GetType((string)p.Element("Type")),
|
||||
Description = (string)p.Element("Description"),
|
||||
Id = (int)p.Element("Id"),
|
||||
Name = (string)p.Element("Name"),
|
||||
Mandatory = (bool)p.Element("Mandatory"),
|
||||
RegularExpression = (string)p.Element("RegularExpression"),
|
||||
TypeName = Normalise((string)p.Element("Alias"))
|
||||
}).ToList(),
|
||||
Associations = x.Descendants("Association").Select(a => new DocTypeAssociation
|
||||
{
|
||||
AllowedId = (int)a
|
||||
}).ToList()
|
||||
});
|
||||
}
|
||||
|
||||
private void ValidateSchema()
|
||||
{
|
||||
XmlSchemaSet schemas = new XmlSchemaSet();
|
||||
//read the resorce for the XSD to validate against
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
schemas.Add("", System.Xml.XmlReader.Create(assembly.GetManifestResourceStream(assembly.GetName().Name + ".DocTypeML.xsd")));
|
||||
|
||||
//we'll have a list of all validation exceptions to put them to the screen
|
||||
List<XmlSchemaException> exList = new List<XmlSchemaException>();
|
||||
|
||||
//some funky in-line event handler. Lambda loving goodness ;)
|
||||
this.Args.Dtml.Validate(schemas, (o, e) => { exList.Add(e.Exception); });
|
||||
|
||||
if (exList.Count > 0)
|
||||
{
|
||||
//dump out the exception list
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine(umbraco.Linq.DTMetal.CodeBuilder.Strings.XsdValidationFailureHeading);
|
||||
foreach (var item in exList)
|
||||
{
|
||||
sb.AppendLine(" * " + item.Message + " - " + item.StackTrace);
|
||||
}
|
||||
throw new XmlSchemaException(sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateDocTypes(IEnumerable<DocType> docTypes, CodeNamespace ns)
|
||||
{
|
||||
foreach (var docType in docTypes)
|
||||
{
|
||||
string genName = docType.TypeName;
|
||||
|
||||
CodeCompileUnit currUnit = new CodeCompileUnit();
|
||||
|
||||
currUnit.Namespaces.Add(ns);
|
||||
|
||||
//create class
|
||||
CodeTypeDeclaration currClass = new CodeTypeDeclaration(genName);
|
||||
//create the custom attribute
|
||||
CodeAttributeDeclarationCollection classAttributes = new CodeAttributeDeclarationCollection(
|
||||
new CodeAttributeDeclaration[] {
|
||||
new CodeAttributeDeclaration("umbracoInfo",
|
||||
new CodeAttributeArgument(new CodePrimitiveExpression(docType.Alias)),
|
||||
new CodeAttributeArgument("Id", new CodePrimitiveExpression(docType.Id))),
|
||||
new CodeAttributeDeclaration(new CodeTypeReference(typeof(DataContractAttribute))),
|
||||
new CodeAttributeDeclaration("DocType")
|
||||
});
|
||||
//add the address to the class
|
||||
currClass.CustomAttributes.AddRange(classAttributes);
|
||||
|
||||
currClass.IsClass = true;
|
||||
//add the summary decoration
|
||||
currClass.Comments.AddRange(GenerateSummary(docType.Description));
|
||||
//set up the type
|
||||
currClass.TypeAttributes = TypeAttributes.Public;
|
||||
if (docType.ParentId > 0)
|
||||
{
|
||||
currClass.BaseTypes.Add(new CodeTypeReference(docTypes.Single(d => d.Id == docType.ParentId).TypeName)); //docType inheritance
|
||||
}
|
||||
else
|
||||
{
|
||||
currClass.BaseTypes.Add(new CodeTypeReference("DocTypeBase")); //base class
|
||||
}
|
||||
currClass.IsPartial = true;
|
||||
|
||||
currClass.Members.AddRange(GenerateConstructors());
|
||||
|
||||
#region Doc Type Properties
|
||||
foreach (var docTypeProperty in docType.Properties)
|
||||
{
|
||||
CodeMemberField valueField = new CodeMemberField();
|
||||
valueField.Attributes = MemberAttributes.Private;
|
||||
valueField.Name = "_" + docTypeProperty.TypeName;
|
||||
valueField.Type = new CodeTypeReference(docTypeProperty.DatabaseType);
|
||||
currClass.Members.Add(valueField);
|
||||
|
||||
//store the umbraco data in an attribute.
|
||||
CodeMemberProperty p = new CodeMemberProperty();
|
||||
p.CustomAttributes.AddRange(GenerateDocTypePropertyAttributes(docTypeProperty));
|
||||
|
||||
p.Name = docTypeProperty.TypeName;
|
||||
p.Type = new CodeTypeReference(docTypeProperty.DatabaseType);
|
||||
p.Attributes = MemberAttributes.Public;
|
||||
p.HasGet = true;
|
||||
p.HasSet = false;
|
||||
p.GetStatements.Add(new CodeMethodReturnStatement(
|
||||
new CodeFieldReferenceExpression(
|
||||
new CodeThisReferenceExpression(), valueField.Name))
|
||||
);
|
||||
|
||||
#region Set statement
|
||||
//have a conditional statment so we can use the INotifyChanging and INotifyChanged events
|
||||
CodeExpression left = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), valueField.Name);
|
||||
CodeExpression right = new CodePropertySetValueReferenceExpression();
|
||||
|
||||
CodeExpression cond = GenerateInequalityConditionalStatement(left, right);
|
||||
|
||||
//Build the statements to execute when we are changing the property value
|
||||
//The order is:
|
||||
// - RaisePropertyChanging event
|
||||
// - Assign the property
|
||||
// - RaisePropertyChanged event
|
||||
var trues = new CodeStatement[] {
|
||||
new CodeExpressionStatement(new CodeMethodInvokeExpression(
|
||||
new CodeThisReferenceExpression(),
|
||||
"RaisePropertyChanging"
|
||||
)
|
||||
),
|
||||
new CodeAssignStatement(
|
||||
new CodeFieldReferenceExpression(
|
||||
new CodeThisReferenceExpression(), valueField.Name),
|
||||
new CodePropertySetValueReferenceExpression()
|
||||
),
|
||||
new CodeExpressionStatement(
|
||||
new CodeMethodInvokeExpression(
|
||||
new CodeThisReferenceExpression(),
|
||||
"RaisePropertyChanged",
|
||||
new CodePrimitiveExpression(docTypeProperty.TypeName)
|
||||
)
|
||||
)
|
||||
};
|
||||
|
||||
CodeConditionStatement condition = new CodeConditionStatement(cond, trues);
|
||||
//enforce the validation from umbraco. It's there for a reason ;)
|
||||
if (!string.IsNullOrEmpty(docTypeProperty.RegularExpression))
|
||||
{
|
||||
p.SetStatements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression(
|
||||
null,
|
||||
"ValidateProperty",
|
||||
new CodePrimitiveExpression(docTypeProperty.RegularExpression),
|
||||
new CodePropertySetValueReferenceExpression())
|
||||
)
|
||||
);
|
||||
}
|
||||
p.SetStatements.Add(condition);
|
||||
#endregion
|
||||
|
||||
//comment the property with the description from umbraco
|
||||
p.Comments.AddRange(GenerateSummary(docTypeProperty.Description));
|
||||
currClass.Members.Add(p);
|
||||
|
||||
CodeMemberProperty retypedProperty = CreateCustomProperty(docTypeProperty, valueField.Name);
|
||||
if (retypedProperty != null)
|
||||
{
|
||||
currClass.Members.Add(retypedProperty);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Child Associations
|
||||
foreach (var child in docType.Associations)
|
||||
{
|
||||
var realDocType = docTypes.SingleOrDefault(dt => dt.Id == child.AllowedId);
|
||||
|
||||
//put a check that a docType is actually returned
|
||||
//This will cater for the bug of when you don't select to generate a
|
||||
//docType but it is a child of the current
|
||||
if (realDocType != null)
|
||||
{
|
||||
CodeMemberField childMember = new CodeMemberField();
|
||||
string name = realDocType.TypeName;
|
||||
if (this.PluralizeCollections)
|
||||
{
|
||||
name = PluraliseName(realDocType.TypeName);
|
||||
}
|
||||
childMember.Attributes = MemberAttributes.Private;
|
||||
childMember.Name = "_" + name;
|
||||
var t = new CodeTypeReference("AssociationTree");
|
||||
t.TypeArguments.Add(realDocType.TypeName);
|
||||
childMember.Type = t;
|
||||
currClass.Members.Add(childMember);
|
||||
|
||||
CodeMemberProperty p = new CodeMemberProperty();
|
||||
p.Name = name;
|
||||
p.Type = t;
|
||||
p.Attributes = MemberAttributes.Public | MemberAttributes.Final;
|
||||
p.HasGet = true;
|
||||
p.HasSet = true;
|
||||
|
||||
CodeExpression left = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), childMember.Name);
|
||||
CodeExpression right = new CodePrimitiveExpression(null);
|
||||
|
||||
CodeExpression cond = GenerateEqualityConditionalStatement(left, right);
|
||||
|
||||
var trues = new CodeConditionStatement(cond, new CodeAssignStatement(
|
||||
new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), childMember.Name),
|
||||
new CodeMethodInvokeExpression(
|
||||
new CodeMethodReferenceExpression(
|
||||
new CodeThisReferenceExpression(),
|
||||
"ChildrenOfType",
|
||||
new CodeTypeReference[] {
|
||||
new CodeTypeReference(realDocType.TypeName)
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
p.GetStatements.Add(trues);
|
||||
p.GetStatements.Add(new CodeMethodReturnStatement(
|
||||
new CodeFieldReferenceExpression(
|
||||
new CodeThisReferenceExpression(), childMember.Name))
|
||||
);
|
||||
|
||||
p.SetStatements.Add(
|
||||
new CodeAssignStatement(
|
||||
new CodeFieldReferenceExpression(
|
||||
new CodeThisReferenceExpression(), childMember.Name),
|
||||
new CodePropertySetValueReferenceExpression()
|
||||
)
|
||||
);
|
||||
|
||||
currClass.Members.Add(p);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
ns.Types.Add(currClass);
|
||||
}
|
||||
}
|
||||
|
||||
private CodeMemberProperty CreateCustomProperty(DocTypeProperty docTypeProperty, string privateVariableName)
|
||||
{
|
||||
var internalTypes = Assembly.GetExecutingAssembly().GetTypes().Where(t => typeof(DataTypeRetyper).IsAssignableFrom(t) && t.GetCustomAttributes(typeof(DataTypeAttribute), true).Length == 1);
|
||||
|
||||
var currType = internalTypes.SingleOrDefault(t => t.GetCustomAttributes(typeof(DataTypeAttribute), true).Cast<DataTypeAttribute>().First().ControlId == docTypeProperty.ControlId);
|
||||
if (currType != null)
|
||||
{
|
||||
var retyper = (DataTypeRetyper)Activator.CreateInstance(currType);
|
||||
|
||||
CodeMemberProperty p = new CodeMemberProperty();
|
||||
p.Type = new CodeTypeReference(retyper.MemberType);
|
||||
p.Name = retyper.MemberName(docTypeProperty.TypeName);
|
||||
p.HasGet = true;
|
||||
p.HasSet = false;
|
||||
|
||||
new Switch(retyper)
|
||||
.Case<YesNoRetyper>(b => {
|
||||
p.GetStatements.Add(new CodeMethodReturnStatement(
|
||||
GenerateEqualityConditionalStatement(
|
||||
new CodeFieldReferenceExpression(
|
||||
new CodeThisReferenceExpression(), privateVariableName)
|
||||
, new CodePrimitiveExpression(0)
|
||||
)
|
||||
)
|
||||
);
|
||||
}, true)
|
||||
;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CodeExpression GenerateInequalityConditionalStatement(CodeExpression left, CodeExpression right)
|
||||
{
|
||||
//Build a binary conditional operation (an IF)
|
||||
CodeExpression cond;
|
||||
//if (GenerationLanaguage == Language.CSharp)
|
||||
//{
|
||||
cond = new CodeBinaryOperatorExpression(
|
||||
left,
|
||||
CodeBinaryOperatorType.IdentityInequality,
|
||||
right
|
||||
);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// cond = new CodeBinaryOperatorExpression(
|
||||
// new CodeBinaryOperatorExpression(
|
||||
// left,
|
||||
// CodeBinaryOperatorType.IdentityEquality,
|
||||
// right
|
||||
// ),
|
||||
// CodeBinaryOperatorType.ValueEquality,
|
||||
// new CodePrimitiveExpression(false)
|
||||
// );
|
||||
//}
|
||||
return cond;
|
||||
}
|
||||
|
||||
private CodeExpression GenerateEqualityConditionalStatement(CodeExpression left, CodeExpression right)
|
||||
{
|
||||
//Build a binary conditional operation (an IF)
|
||||
CodeExpression cond;
|
||||
//if (GenerationLanaguage == Language.CSharp)
|
||||
//{
|
||||
cond = new CodeBinaryOperatorExpression(
|
||||
left,
|
||||
CodeBinaryOperatorType.IdentityEquality,
|
||||
right
|
||||
);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// cond = new CodeBinaryOperatorExpression(
|
||||
// new CodeBinaryOperatorExpression(
|
||||
// left,
|
||||
// CodeBinaryOperatorType.IdentityInequality,
|
||||
// right
|
||||
// ),
|
||||
// CodeBinaryOperatorType.ValueEquality,
|
||||
// new CodePrimitiveExpression(false)
|
||||
// );
|
||||
//}
|
||||
return cond;
|
||||
}
|
||||
|
||||
private CodeAttributeDeclaration[] GenerateDocTypePropertyAttributes(DocTypeProperty docTypeProperty)
|
||||
{
|
||||
List<CodeAttributeDeclaration> attrs = new List<CodeAttributeDeclaration>();
|
||||
|
||||
CodeAttributeDeclaration umbInfoAtt = new CodeAttributeDeclaration("umbracoInfo",
|
||||
new CodeAttributeArgument(new CodePrimitiveExpression(docTypeProperty.Alias)),
|
||||
new CodeAttributeArgument("DisplayName", new CodePrimitiveExpression(docTypeProperty.Name)),
|
||||
new CodeAttributeArgument("Mandatory", new CodePrimitiveExpression(docTypeProperty.Mandatory))
|
||||
);
|
||||
|
||||
attrs.Add(umbInfoAtt);
|
||||
attrs.Add(new CodeAttributeDeclaration("Property"));
|
||||
if (this.SerializationMode == SerializationMode.Unidirectional)
|
||||
{
|
||||
CodeAttributeDeclaration dataMemberAtt = new CodeAttributeDeclaration(new CodeTypeReference(typeof(DataMemberAttribute)),
|
||||
new CodeAttributeArgument("Name", new CodePrimitiveExpression(docTypeProperty.TypeName))
|
||||
);
|
||||
}
|
||||
|
||||
return attrs.ToArray();
|
||||
}
|
||||
|
||||
private static CodeTypeMember[] GenerateConstructors()
|
||||
{
|
||||
CodeConstructor defaultConstructor = new CodeConstructor();
|
||||
defaultConstructor.Attributes = MemberAttributes.Public;
|
||||
|
||||
return new CodeTypeMember[] { defaultConstructor };
|
||||
}
|
||||
|
||||
private static CodeNamespace GenerateNamespace(string name)
|
||||
{
|
||||
CodeNamespace ns = new CodeNamespace(name);
|
||||
//ns.Imports.Add(new CodeNamespaceImport("System"));
|
||||
ns.Imports.Add(new CodeNamespaceImport("umbraco.Linq.Core"));
|
||||
ns.Imports.Add(new CodeNamespaceImport("umbraco.Linq.Core.Node"));
|
||||
ns.Imports.Add(new CodeNamespaceImport("System.Linq"));
|
||||
return ns;
|
||||
}
|
||||
|
||||
private static CodeCommentStatement[] GenerateSummary(string summaryBody)
|
||||
{
|
||||
return new CodeCommentStatement[] {
|
||||
new CodeCommentStatement("<summary>", true),
|
||||
new CodeCommentStatement(summaryBody, true),
|
||||
new CodeCommentStatement("</summary>", true)
|
||||
};
|
||||
}
|
||||
|
||||
private static bool IsVowel(char c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'O':
|
||||
case 'U':
|
||||
case 'Y':
|
||||
case 'A':
|
||||
case 'E':
|
||||
case 'I':
|
||||
case 'o':
|
||||
case 'u':
|
||||
case 'y':
|
||||
case 'a':
|
||||
case 'e':
|
||||
case 'i':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static string PluraliseName(string name)
|
||||
{
|
||||
if ((name.EndsWith("x", StringComparison.OrdinalIgnoreCase) || name.EndsWith("ch", StringComparison.OrdinalIgnoreCase)) || (name.EndsWith("ss", StringComparison.OrdinalIgnoreCase) || name.EndsWith("sh", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
name = name + "es";
|
||||
return name;
|
||||
}
|
||||
if ((name.EndsWith("y", StringComparison.OrdinalIgnoreCase) && (name.Length > 1)) && !IsVowel(name[name.Length - 2]))
|
||||
{
|
||||
name = name.Remove(name.Length - 1, 1);
|
||||
name = name + "ies";
|
||||
return name;
|
||||
}
|
||||
if (!name.EndsWith("s", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
name = name + "s";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
internal string Normalise(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
throw new ArgumentNullException("input");
|
||||
}
|
||||
|
||||
var invalids = new string[] { "_", "-", ".", "$", "@", "*" };
|
||||
|
||||
input = input.Trim().ToLower();
|
||||
|
||||
foreach (var i in invalids)
|
||||
{
|
||||
input = input.Replace(i, " ");
|
||||
}
|
||||
|
||||
var correctCasedInput = VB.Strings.StrConv(input, VB.VbStrConv.ProperCase, 0);
|
||||
|
||||
var correctCasedAsArray = correctCasedInput.Split(' ').Where(s => !string.IsNullOrEmpty(s));
|
||||
|
||||
//var firstItem = correctCasedAsArray[0];
|
||||
StringBuilder ret = new StringBuilder();
|
||||
var foundChar = false;
|
||||
foreach (var item in correctCasedAsArray)
|
||||
{
|
||||
foreach (var c in item)
|
||||
{
|
||||
if (Char.IsLetter(c))
|
||||
{
|
||||
ret.Append(c);
|
||||
foundChar = true;
|
||||
}
|
||||
else if (Char.IsDigit(c) && foundChar)
|
||||
{
|
||||
ret.Append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(ret.ToString()))
|
||||
{
|
||||
throw new IndexOutOfRangeException("No valid characters found within the string being normalised");
|
||||
}
|
||||
|
||||
return ret.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
This code is licensed under the Visual Studio SDK license terms.
|
||||
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.CodeDom;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using Microsoft.Win32;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using VSLangProj80;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the generator class.
|
||||
/// When setting the 'Custom Tool' property of a C# or VB project item to "LINQtoumbracoGenerator",
|
||||
/// the GenerateCode function will get called and will return the contents of the generated file
|
||||
/// to the project system
|
||||
/// </summary>
|
||||
[ComVisible(true)]
|
||||
[Guid("52B316AA-1997-4c81-9969-95404C09EEB4")]
|
||||
[CodeGeneratorRegistration(typeof(LINQtoumbracoGenerator), "C# LINQ to umbraco Class Generator", vsContextGuids.vsContextGuidVCSProject, GeneratesDesignTimeSource = true)]
|
||||
[CodeGeneratorRegistration(typeof(LINQtoumbracoGenerator), "VB LINQ to umbraco Class Generator", vsContextGuids.vsContextGuidVBProject, GeneratesDesignTimeSource = true)]
|
||||
[ProvideObject(typeof(LINQtoumbracoGenerator))]
|
||||
public class LINQtoumbracoGenerator : BaseCodeGeneratorWithSite
|
||||
{
|
||||
#pragma warning disable 0414
|
||||
//The name of this generator (use for 'Custom Tool' property of project item)
|
||||
internal static string name = "LINQtoumbracoGenerator";
|
||||
#pragma warning restore 0414
|
||||
|
||||
/// <summary>
|
||||
/// Function that builds the contents of the generated file based on the contents of the input file
|
||||
/// </summary>
|
||||
/// <param name="inputFileContent">Content of the input file</param>
|
||||
/// <returns>Generated file as a byte array</returns>
|
||||
protected override byte[] GenerateCode(string inputFileContent)
|
||||
{
|
||||
var args = new ClassGeneratorArgs()
|
||||
{
|
||||
Namespace = this.FileNameSpace,
|
||||
Dtml = XDocument.Parse(inputFileContent),
|
||||
Provider = this.GetCodeProvider()
|
||||
};
|
||||
|
||||
var builder = new ClassGenerator(args);
|
||||
|
||||
//this.GetVSProject().References.Add("umbraco.Linq.Core");
|
||||
//this.GetVSProject().References.Add("System.Core");
|
||||
//this.GetVSProject().References.Add("umbraco");
|
||||
|
||||
builder.GenerateCode();
|
||||
return builder.SaveForVs();
|
||||
}
|
||||
|
||||
protected override string GetDefaultExtension()
|
||||
{
|
||||
return ".designer" + base.GetDefaultExtension();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{461089E7-008E-4737-BA17-E1FCD1CC3D0E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>umbraco.Linq.DTMetal.CodeBuilder</RootNamespace>
|
||||
<AssemblyName>umbraco.Linq.DTMetal.CodeBuilder</AssemblyName>
|
||||
<CommonRegAttributes>$(VSSDK90Install)VisualStudioIntegration\Common\Source\CSharp\RegistrationAttributes</CommonRegAttributes>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\Solution Items\umbraco-key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\umbraco.Linq.DTMetal.CodeBuilder.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EnvDTE">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="EnvDTE80">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Microsoft.VisualStudio.Designer.Interfaces" />
|
||||
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.9.0" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Microsoft.VisualStudio.TemplateWizardInterface, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization">
|
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="VSLangProj">
|
||||
</Reference>
|
||||
<Reference Include="VSLangProj2">
|
||||
<HintPath>$(DevEnvDir)\VSLangProj2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="VSLangProj80">
|
||||
<HintPath>$(DevEnvDir)\VSLangProj80.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Solution Items\SolutionInfo.cs">
|
||||
<Link>Properties\SolutionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Code Builder\BaseCodeGenerator.cs" />
|
||||
<Compile Include="Code Builder\BaseCodeGeneratorWithSite.cs" />
|
||||
<Compile Include="$(CommonRegAttributes)\CodeGeneratorRegistrationAttribute.cs">
|
||||
<Link>RegistrationAttributes\CodeGeneratorRegistrationAttribute.cs</Link>
|
||||
<Visible>true</Visible>
|
||||
</Compile>
|
||||
<Compile Include="Code Builder\ClassGenerator.cs" />
|
||||
<Compile Include="DataType\DataTypeAttribute.cs" />
|
||||
<Compile Include="DataType\DataTypeRetyper.cs" />
|
||||
<Compile Include="DataType\YesNoRetyper.cs" />
|
||||
<Compile Include="DocType.cs" />
|
||||
<Compile Include="DocTypeAssociation.cs" />
|
||||
<Compile Include="DocTypeProperty.cs" />
|
||||
<Compile Include="Installer\InstallerHandler.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Installer\InstallerProgress.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Installer\InstallerProgress.Designer.cs">
|
||||
<DependentUpon>InstallerProgress.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Strings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Strings.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Code Builder\LINQtoUmbracoGenerator.cs" />
|
||||
<Compile Include="Switch.cs" />
|
||||
<Compile Include="Wizard\CreateDtmlWizard.cs" />
|
||||
<EmbeddedResource Include="..\..\..\dep\Schemas\DocTypeML.xsd">
|
||||
<Link>DocTypeML.xsd</Link>
|
||||
</EmbeddedResource>
|
||||
<None Include="..\Solution Items\umbraco-key.snk">
|
||||
<Link>Properties\umbraco-key.snk</Link>
|
||||
</None>
|
||||
<None Include="Code Builder\ClassDiagram.cd" />
|
||||
<Content Include="Item packages\LINQtoUmbracoVB.zip" />
|
||||
<Content Include="Item packages\LINQtoUmbracoCS.zip" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppDesigner Include="Project\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Strings.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
|
||||
<CustomToolNamespace>Umbraco.Linq.DTMetal.CodeBuilder</CustomToolNamespace>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Installer\InstallerProgress.resx">
|
||||
<DependentUpon>InstallerProgress.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<!--
|
||||
To specify a different registry root to register your package, uncomment the TargetRegistryRoot
|
||||
tag and specify a registry root in it.
|
||||
<TargetRegistryRoot></TargetRegistryRoot>
|
||||
-->
|
||||
<RegisterOutputPackage>true</RegisterOutputPackage>
|
||||
<RegisterWithCodebase>true</RegisterWithCodebase>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug - Fixed Version' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug - Fixed Version\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;FIXEDVERSION</DefineConstants>
|
||||
<DocumentationFile>bin\Debug\Umbraco.Linq.DTMetal.CodeBuilder.xml</DocumentationFile>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\VSSDK\Microsoft.VsSDK.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -0,0 +1,20 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe</StartProgram>
|
||||
<StartArguments>/ranu /rootsuffix Exp</StartArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe</StartProgram>
|
||||
<StartArguments>/ranu /rootsuffix Exp</StartArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug - Fixed Version' ">
|
||||
<StartProgram>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe</StartProgram>
|
||||
<StartArguments>/ranu /rootsuffix Exp</StartArguments>
|
||||
<StartAction>Program</StartAction>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder.DataType
|
||||
{
|
||||
[global::System.AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
|
||||
public sealed class DataTypeAttribute : Attribute
|
||||
{
|
||||
public DataTypeAttribute(string controlId)
|
||||
{
|
||||
this.ControlId = new Guid(controlId);
|
||||
}
|
||||
|
||||
public Guid ControlId { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder.DataType
|
||||
{
|
||||
public abstract class DataTypeRetyper
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the .NET type of the DataType
|
||||
/// </summary>
|
||||
/// <value>The type of the member.</value>
|
||||
public abstract Type MemberType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates the name for the retyped member. Overload if custom naming is required
|
||||
/// </summary>
|
||||
/// <param name="baseName">Name used for the standard implementation</param>
|
||||
/// <returns>baseName + MemberType.Name</returns>
|
||||
public virtual string MemberName(string baseName)
|
||||
{
|
||||
return baseName + this.MemberType.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder.DataType
|
||||
{
|
||||
/// <summary>
|
||||
/// A converter for the Yes/ No DataType
|
||||
/// </summary>
|
||||
[DataType("38b352c1-e9f8-4fd8-9324-9a2eab06d97a")]
|
||||
public sealed class YesNoRetyper : DataTypeRetyper
|
||||
{
|
||||
public override Type MemberType
|
||||
{
|
||||
get { return typeof(bool); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder
|
||||
{
|
||||
public sealed class DocType
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ParentId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Alias { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
|
||||
public List<DocTypeProperty> Properties { get; set; }
|
||||
public List<DocTypeAssociation> Associations { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder
|
||||
{
|
||||
public sealed class DocTypeAssociation
|
||||
{
|
||||
public int AllowedId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder
|
||||
{
|
||||
public sealed class DocTypeProperty
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Alias { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool Mandatory { get; set; }
|
||||
public string RegularExpression { get; set; }
|
||||
public Type DatabaseType { get; set; }
|
||||
public Guid ControlId { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.ComponentModel;
|
||||
using Microsoft.Win32;
|
||||
using System.Windows.Forms;
|
||||
using System.Globalization;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder.Installer
|
||||
{
|
||||
[RunInstaller(true)]
|
||||
public class InstallerHandler : System.Configuration.Install.Installer
|
||||
{
|
||||
public override void Install(System.Collections.IDictionary stateSaver)
|
||||
{
|
||||
base.Install(stateSaver);
|
||||
|
||||
var vsPath9 = GetVsPath9();
|
||||
var vsPath10 = GetVsPath10();
|
||||
var targetPath = Context.Parameters["TargetDir"];
|
||||
|
||||
if ((vsPath9 != null || vsPath10 != null) && targetPath != null)
|
||||
{
|
||||
var progress = new InstallerProgress(InstallMode.Install, vsPath9, vsPath10, targetPath);
|
||||
MessageBoxOptions options = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ? MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading : 0;
|
||||
if (progress.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
MessageBox.Show(Strings.InstallFailureMessage, "LINQ to umbraco Setup", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, options);
|
||||
MessageBox.Show(progress.Error.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetVsPath9()
|
||||
{
|
||||
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0", false);
|
||||
if (key != null)
|
||||
return (string)key.GetValue("InstallDir");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string GetVsPath10()
|
||||
{
|
||||
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0", false);
|
||||
if (key != null)
|
||||
return (string)key.GetValue("InstallDir");
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void Uninstall(System.Collections.IDictionary savedState)
|
||||
{
|
||||
base.Uninstall(savedState);
|
||||
|
||||
var vsPath9 = GetVsPath9();
|
||||
var vsPath10 = GetVsPath10();
|
||||
if (vsPath9 != null || vsPath10 != null)
|
||||
{
|
||||
var progress = new InstallerProgress(InstallMode.Uninstall, vsPath9, vsPath10, null);
|
||||
progress.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+84
@@ -0,0 +1,84 @@
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder.Installer
|
||||
{
|
||||
partial class InstallerProgress
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallerProgress));
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.installWorker = new System.ComponentModel.BackgroundWorker();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
resources.ApplyResources(this.progressBar1, "progressBar1");
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
||||
//
|
||||
// installWorker
|
||||
//
|
||||
this.installWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.installWorker_DoWork);
|
||||
this.installWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.installWorker_RunWorkerCompleted);
|
||||
//
|
||||
// InstallerProgress
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "InstallerProgress";
|
||||
this.Load += new System.EventHandler(this.InstallerProgress_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.ComponentModel.BackgroundWorker installWorker;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Globalization;
|
||||
using Microsoft.Win32;
|
||||
using System.Linq;
|
||||
|
||||
namespace umbraco.Linq.DTMetal.CodeBuilder.Installer
|
||||
{
|
||||
public partial class InstallerProgress : Form
|
||||
{
|
||||
private const string generatorKey = "{52B316AA-1997-4c81-9969-95404C09EEB4}";
|
||||
private const string dtml = ".dtml";
|
||||
private const string clas = "LINQtoumbraco.DTML.1.0";
|
||||
private const string desc = "LINQ to umbraco Entity Mapping";
|
||||
|
||||
private InstallMode _mode;
|
||||
private string _vs9Path;
|
||||
private string _vs10Path;
|
||||
private string _targetPath;
|
||||
|
||||
internal InstallerProgress(InstallMode mode, string vs9Path, string vs10Path, string targetPath)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_mode = mode;
|
||||
_vs9Path = vs9Path;
|
||||
_vs10Path = vs10Path;
|
||||
_targetPath = targetPath;
|
||||
}
|
||||
|
||||
#region Events
|
||||
private void installWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
|
||||
switch (_mode)
|
||||
{
|
||||
case InstallMode.Install:
|
||||
InstallVsTemplates();
|
||||
SetupRegistry();
|
||||
InstallDtmlXsd();
|
||||
ConfigVs();
|
||||
break;
|
||||
case InstallMode.Uninstall:
|
||||
UninstallVsTemplates();
|
||||
TearDownRegistry();
|
||||
UninstallDtmlXsd();
|
||||
ConfigVs();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void installWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
if (e.Error != null)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Error = e.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
public Exception Error { get; set; }
|
||||
|
||||
private void InstallerProgress_Load(object sender, EventArgs e)
|
||||
{
|
||||
installWorker.RunWorkerAsync();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Uninstall
|
||||
private void UninstallDtmlXsd()
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(GetDtmlXsdPathVs9());
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(GetDtmlXsdPathVs10());
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void TearDownRegistry()
|
||||
{
|
||||
if(Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey) != null)
|
||||
{
|
||||
Registry.LocalMachine.DeleteSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey);
|
||||
}
|
||||
|
||||
if (Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\VisualStudio\10.0\CLSID\" + generatorKey) != null)
|
||||
{
|
||||
Registry.LocalMachine.DeleteSubKey(@"Software\Microsoft\VisualStudio\10.0\CLSID\" + generatorKey);
|
||||
}
|
||||
|
||||
if (Registry.ClassesRoot.OpenSubKey(dtml) != null)
|
||||
{
|
||||
Registry.ClassesRoot.DeleteSubKeyTree(dtml);
|
||||
}
|
||||
|
||||
if (Registry.ClassesRoot.OpenSubKey(clas) != null)
|
||||
{
|
||||
Registry.ClassesRoot.DeleteSubKeyTree(clas);
|
||||
}
|
||||
}
|
||||
|
||||
private void UninstallVsTemplates()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_vs9Path))
|
||||
{
|
||||
string csTgt = Path.Combine(_vs9Path, @"ItemTemplates\CSharp\1033\LINQtoumbracoCS.zip");
|
||||
string vbTgt = Path.Combine(_vs9Path, @"ItemTemplates\VisualBasic\1033\LINQtoumbracoVB.zip");
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(csTgt);
|
||||
File.Delete(vbTgt);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_vs10Path))
|
||||
{
|
||||
string csTgt = Path.Combine(_vs10Path, @"ItemTemplates\CSharp\1033\LINQtoumbracoCS.zip");
|
||||
string vbTgt = Path.Combine(_vs10Path, @"ItemTemplates\VisualBasic\1033\LINQtoumbracoVB.zip");
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(csTgt);
|
||||
File.Delete(vbTgt);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Install
|
||||
private void InstallDtmlXsd()
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
|
||||
// Load the XSD for DocTypeML.
|
||||
string xsd;
|
||||
using (Stream s = assembly.GetManifestResourceStream(assembly.GetName().Name + ".DocTypeML.xsd"))
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(s))
|
||||
{
|
||||
xsd = sr.ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
// Write the XSD to the Visual Studio folder with XML schemas.
|
||||
if (!string.IsNullOrEmpty(_vs9Path))
|
||||
{
|
||||
using (StreamWriter sw = File.CreateText(GetDtmlXsdPathVs9()))
|
||||
{
|
||||
sw.Write(xsd);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_vs10Path))
|
||||
{
|
||||
using (StreamWriter sw = File.CreateText(GetDtmlXsdPathVs10()))
|
||||
{
|
||||
sw.Write(xsd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupRegistry()
|
||||
{
|
||||
#region LINQtoumbracoGenerator Key
|
||||
if (!string.IsNullOrEmpty(_vs9Path))
|
||||
{
|
||||
RegistryKey genKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\VisualStudio\9.0\CLSID\" + generatorKey);
|
||||
genKey.SetValue("Assembly", Assembly.GetExecutingAssembly().FullName); //full name of the assembly which the generator is in
|
||||
genKey.SetValue("Class", "umbraco.Linq.DTMetal.CodeBuilder.LINQtoumbracoGenerator"); //generator class
|
||||
genKey.SetValue("InprocServer32", Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), @"system32\mscoree.dll"));
|
||||
genKey.SetValue("ThreadingModel", "Both");
|
||||
genKey.Close();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_vs10Path))
|
||||
{
|
||||
RegistryKey genKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\VisualStudio\10.0\CLSID\" + generatorKey);
|
||||
genKey.SetValue("Assembly", Assembly.GetExecutingAssembly().FullName); //full name of the assembly which the generator is in
|
||||
genKey.SetValue("Class", "umbraco.Linq.DTMetal.CodeBuilder.LINQtoumbracoGenerator"); //generator class
|
||||
genKey.SetValue("InprocServer32", Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), @"system32\mscoree.dll"));
|
||||
genKey.SetValue("ThreadingModel", "Both");
|
||||
genKey.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\.dtml
|
||||
{
|
||||
RegistryKey dtmlKey = Registry.ClassesRoot.CreateSubKey(dtml, RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||
dtmlKey.SetValue(null, clas);
|
||||
dtmlKey.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0
|
||||
{
|
||||
RegistryKey kClas = Registry.ClassesRoot.CreateSubKey(clas, RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||
kClas.SetValue(null, desc);
|
||||
kClas.SetValue("AlwaysShowExt", "1");
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\DefaultIcon
|
||||
{
|
||||
RegistryKey kIcon = kClas.CreateSubKey("DefaultIcon");
|
||||
kIcon.SetValue(null, Path.Combine(_targetPath, @"DTMetal.exe") + ",0");
|
||||
kIcon.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell
|
||||
{
|
||||
RegistryKey kShel = kClas.CreateSubKey("shell");
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open
|
||||
{
|
||||
RegistryKey kOpen = kShel.CreateSubKey("Open");
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open\Command
|
||||
{
|
||||
RegistryKey kComm = kOpen.CreateSubKey("Command");
|
||||
kComm.SetValue(null, "\"" + Path.Combine(_vs9Path, "devenv.exe") + "\" /dde \"%1\"");
|
||||
kComm.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open\ddeexec
|
||||
{
|
||||
RegistryKey kDdex = kOpen.CreateSubKey("ddeexec");
|
||||
kDdex.SetValue(null, "Open(\"%1\")");
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open\ddeexec\Application
|
||||
{
|
||||
RegistryKey kAppn = kDdex.CreateSubKey("Application");
|
||||
kAppn.SetValue(null, "VisualStudio.9.0");
|
||||
kAppn.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HKEY_CLASSES_ROOT\LINQtoumbraco.DTML.1.0\shell\Open\ddeexec\Topic
|
||||
{
|
||||
RegistryKey kTopc = kDdex.CreateSubKey("Topic");
|
||||
kTopc.SetValue(null, "system");
|
||||
kTopc.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
kDdex.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
kOpen.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
kShel.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
kClas.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private void InstallVsTemplates()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_vs9Path))
|
||||
{
|
||||
string csSrc = Path.Combine(_targetPath, @"Item packages\LINQtoumbracoCS.zip");
|
||||
string vbSrc = Path.Combine(_targetPath, @"Item packages\LINQtoumbracoVB.zip");
|
||||
string csTgt = Path.Combine(_vs9Path, @"ItemTemplates\CSharp\1033\LINQtoumbracoCS.zip");
|
||||
string vbTgt = Path.Combine(_vs9Path, @"ItemTemplates\VisualBasic\1033\LINQtoumbracoVB.zip");
|
||||
|
||||
if (!File.Exists(csTgt))
|
||||
File.Copy(csSrc, csTgt);
|
||||
if (!File.Exists(vbTgt))
|
||||
File.Copy(vbSrc, vbTgt);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_vs10Path))
|
||||
{
|
||||
string csSrc = Path.Combine(_targetPath, @"Item packages\LINQtoumbracoCS.zip");
|
||||
string vbSrc = Path.Combine(_targetPath, @"Item packages\LINQtoumbracoVB.zip");
|
||||
string csTgt = Path.Combine(_vs10Path, @"ItemTemplates\CSharp\1033\LINQtoumbracoCS.zip");
|
||||
string vbTgt = Path.Combine(_vs10Path, @"ItemTemplates\VisualBasic\1033\LINQtoumbracoVB.zip");
|
||||
|
||||
if (!File.Exists(csTgt))
|
||||
File.Copy(csSrc, csTgt);
|
||||
if (!File.Exists(vbTgt))
|
||||
File.Copy(vbSrc, vbTgt);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private string GetDtmlXsdPathVs9()
|
||||
{
|
||||
string path = _vs9Path; //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\
|
||||
path = path.TrimEnd('\\'); //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE
|
||||
path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 9.0\Common7
|
||||
path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 9.0
|
||||
path = Path.Combine(path, "Xml"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml
|
||||
path = Path.Combine(path, "Schemas"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas
|
||||
path = Path.Combine(path, "DocTypeML.xsd"); //%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas\DocTypeML.xsd
|
||||
return path;
|
||||
}
|
||||
|
||||
private string GetDtmlXsdPathVs10()
|
||||
{
|
||||
string path = _vs10Path; //%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\
|
||||
path = path.TrimEnd('\\'); //%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE
|
||||
path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 10.0\Common7
|
||||
path = path.Substring(0, path.LastIndexOf('\\')); //%ProgramFiles%\Microsoft Visual Studio 10.0
|
||||
path = Path.Combine(path, "Xml"); //%ProgramFiles%\Microsoft Visual Studio 10.0\Xml
|
||||
path = Path.Combine(path, "Schemas"); //%ProgramFiles%\Microsoft Visual Studio 10.0\Xml\Schemas
|
||||
path = Path.Combine(path, "DocTypeML.xsd"); //%ProgramFiles%\Microsoft Visual Studio 10.0\Xml\Schemas\DocTypeML.xsd
|
||||
return path;
|
||||
}
|
||||
|
||||
private void ConfigVs()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_vs9Path))
|
||||
{
|
||||
string devenv = Path.Combine(_vs9Path, "devenv.exe");
|
||||
Process p = Process.Start(devenv, "/InstallVSTemplates");
|
||||
p.WaitForExit();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_vs10Path))
|
||||
{
|
||||
string devenv = Path.Combine(_vs10Path, "devenv.exe");
|
||||
Process p = Process.Start(devenv, "/InstallVSTemplates");
|
||||
p.WaitForExit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal enum InstallMode
|
||||
{
|
||||
Install,
|
||||
Uninstall
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>13, 13</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>278, 13</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="label1.Text" xml:space="preserve">
|
||||
<value>LINQ to umbraco is configuring Visual Studio 2008/ 2010</value>
|
||||
</data>
|
||||
<data name=">>label1.Name" xml:space="preserve">
|
||||
<value>label1</value>
|
||||
</data>
|
||||
<data name=">>label1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>38, 30</value>
|
||||
</data>
|
||||
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>221, 13</value>
|
||||
</data>
|
||||
<data name="label2.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label2.Text" xml:space="preserve">
|
||||
<value>This may take a few minutes, please stand by</value>
|
||||
</data>
|
||||
<data name=">>label2.Name" xml:space="preserve">
|
||||
<value>label2</value>
|
||||
</data>
|
||||
<data name=">>label2.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label2.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label2.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="progressBar1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 61</value>
|
||||
</data>
|
||||
<data name="progressBar1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>271, 27</value>
|
||||
</data>
|
||||
<data name="progressBar1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name=">>progressBar1.Name" xml:space="preserve">
|
||||
<value>progressBar1</value>
|
||||
</data>
|
||||
<data name=">>progressBar1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ProgressBar, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>progressBar1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>progressBar1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="installWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>299, 100</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterParent</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>LINQ to umbraco Installer Progress</value>
|
||||
</data>
|
||||
<data name=">>installWorker.Name" xml:space="preserve">
|
||||
<value>installWorker</value>
|
||||
</data>
|
||||
<data name=">>installWorker.Type" xml:space="preserve">
|
||||
<value>System.ComponentModel.BackgroundWorker, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>InstallerProgress</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
+31
@@ -0,0 +1,31 @@
|
||||
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
|
||||
<TemplateData>
|
||||
<Name>LINQ to Umbraco File</Name>
|
||||
<Description>An empty LINQ to Umbraco file</Description>
|
||||
<Icon>umbraco.ico</Icon>
|
||||
<ProjectType>CSharp</ProjectType>
|
||||
<SortOrder>100</SortOrder>
|
||||
<DefaultName>DataClasses.dtml</DefaultName>
|
||||
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
|
||||
<TemplateID>Umbraco.Linq.Core.Designer</TemplateID>
|
||||
<RequiredFrameworkVersion>3.5</RequiredFrameworkVersion>
|
||||
</TemplateData>
|
||||
<TemplateContent>
|
||||
<References>
|
||||
<Reference>
|
||||
<Assembly>System</Assembly>
|
||||
</Reference>
|
||||
<Reference>
|
||||
<Assembly>System.Core</Assembly>
|
||||
</Reference>
|
||||
<Reference>
|
||||
<Assembly>Umbraco.Linq.Core</Assembly>
|
||||
</Reference>
|
||||
</References>
|
||||
<ProjectItem TargetFileName="$fileinputname$.dtml" ReplaceParameters="true">dtml.dtml</ProjectItem>
|
||||
<CustomParameters>
|
||||
<CustomParameter Name="$Generator$" Value="LINQtoUmbracoGenerator" />
|
||||
<CustomParameter Name="$Namespace$" Value="$rootnamespace$" />
|
||||
</CustomParameters>
|
||||
</TemplateContent>
|
||||
</VSTemplate>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
<auto-generated>
|
||||
This code was generated by a tool.
|
||||
LINQ to Umbraco Version: $version$
|
||||
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</auto-generated>
|
||||
-->
|
||||
|
||||
<DocumentTypes Serialization="Unidirectional" DataContextName="$fileinputname$" PluralizeCollections="true">
|
||||
|
||||
</DocumentTypes>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user