update vor token

This commit is contained in:
Stefan Hutter
2024-10-01 15:26:52 +02:00
parent bbace0411f
commit 4c4d27bf48
2069 changed files with 493200 additions and 150 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!-- If runtime tag is absent -->
<runtime xdt:Transform="InsertIfMissing">
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>
</runtime>
<!-- If runtime tag is present, but assembly binding tag is absent -->
<runtime>
<assemblyBinding xdt:Transform="InsertIfMissing" xmlns="urn:schemas-microsoft-com:asm.v1">
</assemblyBinding>
</runtime>
<!-- If the binding redirect is already present, the existing entry needs to be removed before inserting the new entry-->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Remove"
xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Web.Mvc')" >
</dependentAssembly>
</assemblyBinding>
</runtime>
<!-- Inserting the new binding redirect -->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Insert">
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.9.0" newVersion="5.2.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Remove"
xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Web.Mvc')" >
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,127 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT .NET LIBRARY
These license terms are an agreement between Microsoft Corporation (or based on where you live, one
of its affiliates) and you. They apply to the software named above. The terms also apply to any Microsoft
services or updates for the software, except to the extent those have different terms.
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.
1. INSTALLATION AND USE RIGHTS.
You may install and use any number of copies of the software to design, develop and test youre
applications. You may modify, copy, distribute or deploy any .js files contained in the software as
part of your applications.
2. THIRD PARTY COMPONENTS. The software may include third party components with separate legal
notices or governed by other agreements, as may be described in the ThirdPartyNotices file(s)
accompanying the software.
3. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
a. DISTRIBUTABLE CODE. In addition to the .js files described above, the software is comprised
of Distributable Code. “Distributable Code” is code that you are permitted to distribute in
programs you develop if you comply with the terms below.
i. Right to Use and Distribute.
• You may copy and distribute the object code form of the software.
• Third Party Distribution. You may permit distributors of your programs to copy and
distribute the Distributable Code as part of those programs.
ii. Distribution Requirements. For any Distributable Code you distribute, you must
• use the Distributable Code in your programs and not as a standalone distribution;
• require distributors and external end users to agree to terms that protect it at least as
much as this agreement;
• display your valid copyright notice on your programs; and
• indemnify, defend, and hold harmless Microsoft from any claims, including attorneys
fees, related to the distribution or use of your applications, except to the extent that any
claim is based solely on the Distributable Code.
iii. Distribution Restrictions. You may not
• alter any copyright, trademark or patent notice in the Distributable Code;
• use Microsofts trademarks in your programs names or in a way that suggests your
programs come from or are endorsed by Microsoft;
• include Distributable Code in malicious, deceptive or unlawful programs; or
• modify or distribute the source code of any Distributable Code so that any part of it
becomes subject to an Excluded License. An Excluded License is one that requires, as a
condition of use, modification or distribution, that
• the code be disclosed or distributed in source code form; or
• others have the right to modify it.
4. DATA.
a. Data Collection. The software may collect information about you and your use of the software,
and send that to Microsoft. Microsoft may use this information to provide services and improve
our products and services. You may opt-out of many of these scenarios, but not all, as described
in the product documentation. There are also some features in the software that may enable
you and Microsoft to collect data from users of your applications. If you use these features, you
must comply with applicable law, including providing appropriate notices to users of your
applications together with a copy of Microsofts privacy statement. Our privacy statement is
located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data
collection and use in the help documentation and our privacy statement. Your use of the software
operates as your consent to these practices.
b. Processing of Personal Data. To the extent Microsoft is a processor or subprocessor of
personal data in connection with the software, Microsoft makes the commitments in the
European Union General Data Protection Regulation Terms of the Online Services Terms to all
customers effective May 25, 2018, at http://go.microsoft.com/?linkid=9840733.
5. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights
to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights
despite this limitation, you may use the software only as expressly permitted in this agreement. In
doing so, you must comply with any technical limitations in the software that only allow you to use it
in certain ways. You may not
• work around any technical limitations in the software;
• reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the
source code for the software, except and to the extent required by third party licensing terms
governing use of certain open source components that may be included in the software;
• remove, minimize, block or modify any notices of Microsoft or its suppliers in the software;
• use the software in any way that is against the law; or
• share, publish, rent or lease the software, provide the software as a stand-alone offering for
others to use, or transfer the software or this agreement to any third party.
6. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall
the software.
7. DOCUMENTATION. Any person that has valid access to your computer or internal network may
copy and use the documentation for your internal, reference purposes.
8. EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and
regulations that apply to the software, which include restrictions on destinations, end users, and end
use. For further information on export restrictions, visit www.microsoft.com/exporting.
9. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
10. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based
services and support services that you use, are the entire agreement for the software and support
services.
11. APPLICABLE LAW. If you acquired the software in the United States, Washington law applies to
interpretation of and claims for breach of this agreement, and the laws of the state where you live
apply to all other claims. If you acquired the software in any other country, its laws apply.
12. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights.
You may have other rights, including consumer rights, under the laws of your state or country.
Separate and apart from your relationship with Microsoft, you may also have rights with respect to
the party from which you acquired the software. This agreement does not change those other rights
if the laws of your state or country do not permit it to do so. For example, if you acquired the
software in one of the below regions, or mandatory country law applies, then the following provisions
apply to you:
a) Australia. You have statutory guarantees under the Australian Consumer Law and nothing in
this agreement is intended to affect those rights.
b) Canada. If you acquired this software in Canada, you may stop receiving updates by turning off
the automatic update feature, disconnecting your device from the Internet (if and when you re-
connect to the Internet, however, the software will resume checking for and installing updates),
or uninstalling the software. The product documentation, if any, may also specify how to turn off
updates for your specific device or software.
c) Germany and Austria.
(i) Warranty. The software will perform substantially as described in any Microsoft
materials that accompany it. However, Microsoft gives no contractual guarantee in relation to the
software.
(ii) Limitation of Liability. In case of intentional conduct, gross negligence, claims based
on the Product Liability Act, as well as in case of death or personal or physical injury, Microsoft is
liable according to the statutory law.
Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft is in
breach of such material contractual obligations, the fulfillment of which facilitate the due
performance of this agreement, the breach of which would endanger the purpose of this agreement
and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In
other cases of slight negligence, Microsoft will not be liable for slight negligence
13. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK
OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR
CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT
EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON-INFRINGEMENT.
14. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER
FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU
CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS,
SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
This limitation applies to (a) anything related to the software, services, content (including code) on
third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of
warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by
applicable law.
It also applies even if Microsoft knew or should have known about the possibility of the damages.
The above limitation or exclusion may not apply to you because your state or country may not allow
the exclusion or limitation of incidental, consequential or other damages.
Please note: As this software is distributed in Quebec, Canada, some of the clauses in this
agreement are provided below in French.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,141 @@
MICROSOFT-SOFTWARE-LIZENZBEDINGUNGEN
MICROSOFT .NET-BIBLIOTHEK
Bei diesen Lizenzbestimmungen handelt es sich um eine Vereinbarung zwischen Ihnen und der Microsoft
Corporation (oder je nach Ihrem Wohnsitz, einem ihrer Affiliate-Partner). Sie gelten für die oben
angeführte Software. Die Bestimmungen gelten ebenso für jegliche von Microsoft angebotenen Dienste
oder Updates für die Software, sofern diesen keine anderen Bestimmungen beiliegen.
WENN SIE DIESE LIZENZBESTIMMUNGEN EINHALTEN, VERFÜGEN SIE ÜBER DIE
NACHFOLGEND AUFGEFÜHRTEN RECHTE:
1. INSTALLATIONS- UND NUTZUNGSRECHTE.
Sie sind berechtigt, eine beliebige Anzahl an Kopien der Software zum Entwickeln und Testen Ihrer
Anwendungen zu installieren und zu verwenden.
2. KOMPONENTEN DRITTER. Diese Software kann Komponenten Dritter enthalten, die gesonderten
rechtlichen Anmerkungen oder anderen Verträgen unterliegen, wie in den der Software beiliegenden
ThirdPartyNotices-Dateien ggf. beschrieben ist.
3. ZUSÄTZLICHE LIZENZANFORDERUNGEN UND/ODER NUTZUNGSRECHTE.
a. VERTREIBBARER CODE. Die Software besteht aus vertreibbarem Code. Der „vertreibbare
Code“ ist Code, den Sie in von Ihnen entwickelten Anwendungen verteilen dürfen, wenn Sie die
folgenden Bestimmungen einhalten.
i. Recht zur Nutzung und zum Vertrieb.
• Sie dürfen die Objektcodeform der Software kopieren und verteilen.
• Vertrieb durch Dritte. Sie sind berechtigt, Distributoren Ihrer Anwendungen zu erlauben,
den vertreibbaren Code als Teil dieser Anwendungen zu kopieren und zu vertreiben.
ii. Vertriebsbedingungen. Für vertreibbaren Code, den Sie vertreiben, sind Sie
verpflichtet:
• den vertreibbaren Code in Ihren Anwendungen zu verwenden und nicht als
eigenständige Verteilung;
• von Händlern und externen Endbenutzern die Zustimmung zu Bedingungen zu verlangen,
die einen mindestens gleichwertigen Schutz für den Code bieten wie diese Vereinbarung;
und
• Microsoft von allen Ansprüchen und Kosten, einschließlich Anwaltsgebühren, freistellen
und gegen alle Ansprüche verteidigen, die mit dem Vertrieb oder der Nutzung Ihrer
Anwendungen in Zusammenhang stehen, außer insoweit sich ein Anspruch ausschließlich
auf den unveränderten vertreibbaren Code stützt.
iii. Vertriebsbeschränkungen. Sie sind nicht dazu berechtigt:
• die Marken von Microsoft in den Namen Ihrer Anwendungen oder auf eine Weise zu
verwenden, die nahelegt, dass Ihre Anwendungen von Microsoft stammen oder von
Microsoft empfohlen werden, oder
• den Quellcode von vertreibbarem Code so zu ändern oder zu vertreiben, dass irgendein
Teil von ihm einer ausgeschlossenen Lizenz unterliegt. Bei einer „ausgeklammerten
Lizenz" handelt es sich um eine Lizenz, die als Bedingung für Nutzung, Änderung oder
Verteilung des Codes erfordert, dass (a) diese in Quellcodeform offengelegt oder verteilt
wird oder (b) andere das Recht haben, dieselbe zu ändern.
4. DATEN.
a. Datenerfassung. Die Software erhebt möglicherweise Informationen über Sie und Ihre
Verwendung der Software und sendet diese an Microsoft. Microsoft kann diese Informationen
verwenden, um unsere Produkte und Dienste bereitzustellen und zu verbessern. Sie können sich
gegen viele dieser Szenarios entscheiden, jedoch nicht gegen alle, wie in der
Softwaredokumentation beschrieben. Die Software besitzt auch einige Funktionen, mit denen Sie
und Microsoft Informationen über die Nutzer Ihrer Anwendungen sammeln können. Wenn Sie
diese Funktionen nutzen, müssen Sie die geltenden Gesetze einhalten, einschließlich der
Bereitstellung entsprechender Hinweise für Nutzer Ihrer Anwendungen zusammen mit einer
Kopie der Datenschutzerklärung von Microsoft. Unsere Datenschutzerklärung finden Sie unter
https://go.microsoft.com/fwlink/?LinkID=824704. Mehr über Datensammlung und deren Nutzung
können Sie in der Softwaredokumentation und in unserer Datenschutzerklärung erfahren. Durch
die Nutzung der Software erklären Sie sich mit diesen Praktiken einverstanden.
b. Verarbeitung personenbezogener Daten. Soweit Microsoft im Zusammenhang mit der
Software als Auftragsverarbeiter oder Unterauftragsverarbeiter von personenbezogenen Daten
auftritt, geht Microsoft im Rahmen der Datenschutz-Grundverordnung der Europäischen Union
zum 25. Mai 2018 allen Kunden gegenüber die Verpflichtungen gemäß den Bestimmungen für
Onlinedienste ein, die unter https://docs.microsoft.com/en-us/legal/gdpr verfügbar sind.
5. GÜLTIGKEITSBEREICH DER LIZENZ. Die Software wird lizenziert, nicht verkauft. Diese
Vereinbarung gewährt Ihnen lediglich bestimmte Rechte zur Nutzung der Software. Microsoft behält
sich alle anderen Rechte vor. Sie dürfen die Software nur wie in dieser Vereinbarung ausdrücklich
gestattet nutzen, es sei denn, das anwendbare Recht gibt Ihnen ungeachtet dieser Einschränkung
umfassendere Rechte. Dabei sind Sie verpflichtet, alle technischen Beschränkungen der Software
einzuhalten, die Ihnen nur spezielle Verwendungen gestatten. Sie sind nicht dazu berechtigt:
• technische Beschränkungen der Software zu umgehen;
• die Software zurückzuentwickeln, zu dekompilieren oder zu disassemblieren oder anderweitig zu
versuchen, den Quellcode für die Software abzuleiten, ausgenommen und in dem Maße, wie dies
in Lizenzierungsbedingungen für Dritte vorgesehen ist, die die Verwendung bestimmter Open-
Source-Komponenten regeln, die in der Software enthalten sein können;
• Mitteilungen der Firma Microsoft oder ihrer Lieferanten in der Software zu entfernen, zu
minimieren, zu blockieren oder zu verändern;
• die Software auf eine Weise zu verwenden, die gegen das Gesetz verstößt, oder
• die Software gemeinsam zu nutzen, zu veröffentlichen oder zu verleihen oder die Software als
eigenständiges Angebot für Nutzung durch andere bereitzustellen.
6. AUSFUHRBESCHRÄNKUNGEN. Sie sind verpflichtet, alle nationalen und internationalen
Exportgesetze und Exportbestimmungen einzuhalten, die für die Software gelten, welche auch
Beschränkungen in Bezug auf Bestimmungsorte, Endbenutzer und die Endnutzung enthalten. Weitere
Informationen zu Ausfuhrbeschränkungen finden Sie unter www.microsoft.com/exporting.
7. SUPPORTSERVICES. Da diese Software „wie besehen“ verkauft wird, stellen wir für diese
möglicherweise keine Supportleistungen zur Verfügung.
8. GESAMTER VERTRAG. Diese Vereinbarung sowie die Bestimmungen für von Ihnen genutzte
Ergänzungen, Aktualisierungen, internetbasierte Dienste und Supportleistungen stellen die
Gesamtvereinbarung über die Software und die Supportleistungen dar.
9. ANWENDBARES RECHT. Wenn Sie die Software in den USA erworben haben, regeln die Gesetze
des Bundesstaates Washington die Auslegung dieser Vereinbarung sowie Ansprüche, die aus einer
Vertragsverletzung entstehen, und die Gesetze des Bundesstaates, in dem Sie leben, regeln alle
anderen Ansprüche. Wenn Sie die Software in einem anderen Land erworben haben, gelten die
Gesetze dieses Landes.
10. VERBRAUCHERRECHTE, REGIONALE VARIANTEN. Diese Vereinbarung beschreibt bestimmte
Rechte. Möglicherweise sehen die Gesetze Ihres Staats oder Lands andere Rechte vor, einschließlich
Verbraucherrechte. Möglicherweise verfügen Sie unabhängig von Ihrer Geschäftsbeziehung mit
Microsoft außerdem über Rechte im Hinblick auf den Lizenzgeber, von dem Sie die Software
erworben haben. Dieser Vertrag ändert diese anderen Rechte nicht, wenn die Gesetze Ihres
Bundesstaates oder Lands dies nicht gestatten. Wenn Sie die Software beispielsweise in einer der
unten genannten Regionen erworben haben oder zwingendes Recht des Landes Anwendung findet,
gelten die folgenden Bestimmungen für Sie:
a) Australien. Für Sie gelten die gesetzlichen Garantien gemäß des Australian Consumer Law und
diese Vereinbarung hat in keiner Weise die Absicht, diese Rechte einzuschränken.
b) Kanada. Sofern Sie diese Software in Kanada erwarben, können Sie ggf. den Empfang von
Aktualisierungen durch die Deaktivierung der automatischen Aktualisierungsfunktion einstellen
lassen bzw. durch die Trennung Ihres Gerätes vom Internet (sofern Sie das Gerät erneut
verbinden, wird die Software weiterhin Aktualisierungen aus dem Internet abfragen und zu
installieren versuchen) oder durch die Deinstallation der Software. Hinweise zur Deaktivierung
der Aktualisierungsfunktion bei Ihrem spezifischen Gerät oder Ihrer spezifischen Software sind
ggf. im Besonderen auch der jeweiligen Produktdokumentation zu entnehmen.
c) Deutschland und Österreich.
(i) Gewährleistung. Die Software wird im Wesentlichen so funktionieren, wie in den sie
begleitenden Microsoft-Unterlagen beschrieben. Jedoch gewährt Microsoft keine vertragliche
Garantie in Bezug auf die Software.
(ii) Haftungsbeschränkung. Bei Vorsatz, grober Fahrlässigkeit und Ansprüchen nach dem
Produkthaftungsgesetz sowie bei Tod oder Körperverletzung haftet Microsoft nach den
gesetzlichen Bestimmungen.
Vorbehaltlich der vorstehenden Klausel (ii) haftet Microsoft bei leichter Fahrlässigkeit nur, wenn das
Unternehmen eine wesentliche Vertragspflicht verletzt, deren Erfüllung die ordnungsgemäße
Durchführung dieses Vertrages überhaupt erst ermöglicht, deren Verletzung die Erreichung des
Vertragszwecks gefährdet und auf deren Einhaltung eine Partei regelmäßig vertrauen darf (sog.
„Kardinalpflichten“). In anderen Fällen von leichter Fahrlässigkeit haftet Microsoft nicht.
11. AUSSCHLUSS VON GARANTIEN. DIE SOFTWARE WIRD „WIE BESEHEN“ LIZENZIERT. SIE
TRAGEN DAS MIT DER VERWENDUNG VERBUNDENE RISIKO. MICROSOFT GEWÄHRT
KEINE AUSDRÜCKLICHEN GEWÄHRLEISTUNGEN ODER GARANTIEN. IN DEM NACH
IHREM ÖRTLICH ANWENDBAREN RECHT ZULÄSSIGEN UMFANG SCHLIESST MICROSOFT
KONKLUDENTE GARANTIEN DER HANDELSÜBLICHKEIT, EIGNUNG FÜR EINEN
BESTIMMTEN ZWECK UND NICHTVERLETZUNG VON RECHTEN DRITTER AUS.
12. BESCHRÄNKUNG UND AUSSCHLUSS VON ABHILFEANSPRÜCHEN UND SCHADENERSATZ.
SIE KÖNNEN VON MICROSOFT UND DEREN LIEFERANTEN NUR EINEN ERSATZ FÜR
DIREKTE SCHÄDEN BIS ZU EINEM BETRAG VON 5,00 US-DOLLAR ERHALTEN. SIE
KÖNNEN KEINEN ERSATZ FÜR ANDERE SCHÄDEN ERHALTEN, EINSCHLIESSLICH
FOLGESCHÄDEN, SCHÄDEN AUS ENTGANGENEM GEWINN, SPEZIELLER, INDIREKTER
ODER ZUFÄLLIGER SCHÄDEN.
Diese Einschränkung gilt für (a) jeden Gegenstand im Zusammenhang mit der Software, Diensten,
Inhalten (einschließlich Code) auf Internetseiten von Drittanbietern oder Anwendungen von Dritten
und (b) Ansprüche aus Vertragsverletzungen, Verletzungen der Garantie oder der Gewährleistung,
verschuldensunabhängiger Haftung, Fahrlässigkeit oder anderen unerlaubten Handlungen im durch
das anwendbare Recht zugelassenen Umfang.
Sie hat auch dann Gültigkeit, wenn Microsoft von der Möglichkeit der Schäden gewusst hat oder hätte
wissen müssen. Obige Beschränkung und obiger Ausschluss gelten möglicherweise nicht für Sie, weil
Ihr Staat oder Land den Ausschluss oder die Beschränkung von zufälligen Schäden, Folgeschäden
oder sonstigen Schäden nicht gestattet.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,127 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT .NET LIBRARY
These license terms are an agreement between Microsoft Corporation (or based on where you live, one
of its affiliates) and you. They apply to the software named above. The terms also apply to any Microsoft
services or updates for the software, except to the extent those have different terms.
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.
1. INSTALLATION AND USE RIGHTS.
You may install and use any number of copies of the software to design, develop and test youre
applications. You may modify, copy, distribute or deploy any .js files contained in the software as
part of your applications.
2. THIRD PARTY COMPONENTS. The software may include third party components with separate legal
notices or governed by other agreements, as may be described in the ThirdPartyNotices file(s)
accompanying the software.
3. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
a. DISTRIBUTABLE CODE. In addition to the .js files described above, the software is comprised
of Distributable Code. “Distributable Code” is code that you are permitted to distribute in
programs you develop if you comply with the terms below.
i. Right to Use and Distribute.
• You may copy and distribute the object code form of the software.
• Third Party Distribution. You may permit distributors of your programs to copy and
distribute the Distributable Code as part of those programs.
ii. Distribution Requirements. For any Distributable Code you distribute, you must
• use the Distributable Code in your programs and not as a standalone distribution;
• require distributors and external end users to agree to terms that protect it at least as
much as this agreement;
• display your valid copyright notice on your programs; and
• indemnify, defend, and hold harmless Microsoft from any claims, including attorneys
fees, related to the distribution or use of your applications, except to the extent that any
claim is based solely on the Distributable Code.
iii. Distribution Restrictions. You may not
• alter any copyright, trademark or patent notice in the Distributable Code;
• use Microsofts trademarks in your programs names or in a way that suggests your
programs come from or are endorsed by Microsoft;
• include Distributable Code in malicious, deceptive or unlawful programs; or
• modify or distribute the source code of any Distributable Code so that any part of it
becomes subject to an Excluded License. An Excluded License is one that requires, as a
condition of use, modification or distribution, that
• the code be disclosed or distributed in source code form; or
• others have the right to modify it.
4. DATA.
a. Data Collection. The software may collect information about you and your use of the software,
and send that to Microsoft. Microsoft may use this information to provide services and improve
our products and services. You may opt-out of many of these scenarios, but not all, as described
in the product documentation. There are also some features in the software that may enable
you and Microsoft to collect data from users of your applications. If you use these features, you
must comply with applicable law, including providing appropriate notices to users of your
applications together with a copy of Microsofts privacy statement. Our privacy statement is
located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data
collection and use in the help documentation and our privacy statement. Your use of the software
operates as your consent to these practices.
b. Processing of Personal Data. To the extent Microsoft is a processor or subprocessor of
personal data in connection with the software, Microsoft makes the commitments in the
European Union General Data Protection Regulation Terms of the Online Services Terms to all
customers effective May 25, 2018, at http://go.microsoft.com/?linkid=9840733.
5. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights
to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights
despite this limitation, you may use the software only as expressly permitted in this agreement. In
doing so, you must comply with any technical limitations in the software that only allow you to use it
in certain ways. You may not
• work around any technical limitations in the software;
• reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the
source code for the software, except and to the extent required by third party licensing terms
governing use of certain open source components that may be included in the software;
• remove, minimize, block or modify any notices of Microsoft or its suppliers in the software;
• use the software in any way that is against the law; or
• share, publish, rent or lease the software, provide the software as a stand-alone offering for
others to use, or transfer the software or this agreement to any third party.
6. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall
the software.
7. DOCUMENTATION. Any person that has valid access to your computer or internal network may
copy and use the documentation for your internal, reference purposes.
8. EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and
regulations that apply to the software, which include restrictions on destinations, end users, and end
use. For further information on export restrictions, visit www.microsoft.com/exporting.
9. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
10. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based
services and support services that you use, are the entire agreement for the software and support
services.
11. APPLICABLE LAW. If you acquired the software in the United States, Washington law applies to
interpretation of and claims for breach of this agreement, and the laws of the state where you live
apply to all other claims. If you acquired the software in any other country, its laws apply.
12. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights.
You may have other rights, including consumer rights, under the laws of your state or country.
Separate and apart from your relationship with Microsoft, you may also have rights with respect to
the party from which you acquired the software. This agreement does not change those other rights
if the laws of your state or country do not permit it to do so. For example, if you acquired the
software in one of the below regions, or mandatory country law applies, then the following provisions
apply to you:
a) Australia. You have statutory guarantees under the Australian Consumer Law and nothing in
this agreement is intended to affect those rights.
b) Canada. If you acquired this software in Canada, you may stop receiving updates by turning off
the automatic update feature, disconnecting your device from the Internet (if and when you re-
connect to the Internet, however, the software will resume checking for and installing updates),
or uninstalling the software. The product documentation, if any, may also specify how to turn off
updates for your specific device or software.
c) Germany and Austria.
(i) Warranty. The software will perform substantially as described in any Microsoft
materials that accompany it. However, Microsoft gives no contractual guarantee in relation to the
software.
(ii) Limitation of Liability. In case of intentional conduct, gross negligence, claims based
on the Product Liability Act, as well as in case of death or personal or physical injury, Microsoft is
liable according to the statutory law.
Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft is in
breach of such material contractual obligations, the fulfillment of which facilitate the due
performance of this agreement, the breach of which would endanger the purpose of this agreement
and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In
other cases of slight negligence, Microsoft will not be liable for slight negligence
13. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK
OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR
CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT
EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON-INFRINGEMENT.
14. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER
FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU
CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS,
SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
This limitation applies to (a) anything related to the software, services, content (including code) on
third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of
warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by
applicable law.
It also applies even if Microsoft knew or should have known about the possibility of the damages.
The above limitation or exclusion may not apply to you because your state or country may not allow
the exclusion or limitation of incidental, consequential or other damages.
Please note: As this software is distributed in Quebec, Canada, some of the clauses in this
agreement are provided below in French.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,141 @@
MICROSOFT-SOFTWARE-LIZENZBEDINGUNGEN
MICROSOFT .NET-BIBLIOTHEK
Bei diesen Lizenzbestimmungen handelt es sich um eine Vereinbarung zwischen Ihnen und der Microsoft
Corporation (oder je nach Ihrem Wohnsitz, einem ihrer Affiliate-Partner). Sie gelten für die oben
angeführte Software. Die Bestimmungen gelten ebenso für jegliche von Microsoft angebotenen Dienste
oder Updates für die Software, sofern diesen keine anderen Bestimmungen beiliegen.
WENN SIE DIESE LIZENZBESTIMMUNGEN EINHALTEN, VERFÜGEN SIE ÜBER DIE
NACHFOLGEND AUFGEFÜHRTEN RECHTE:
1. INSTALLATIONS- UND NUTZUNGSRECHTE.
Sie sind berechtigt, eine beliebige Anzahl an Kopien der Software zum Entwickeln und Testen Ihrer
Anwendungen zu installieren und zu verwenden.
2. KOMPONENTEN DRITTER. Diese Software kann Komponenten Dritter enthalten, die gesonderten
rechtlichen Anmerkungen oder anderen Verträgen unterliegen, wie in den der Software beiliegenden
ThirdPartyNotices-Dateien ggf. beschrieben ist.
3. ZUSÄTZLICHE LIZENZANFORDERUNGEN UND/ODER NUTZUNGSRECHTE.
a. VERTREIBBARER CODE. Die Software besteht aus vertreibbarem Code. Der „vertreibbare
Code“ ist Code, den Sie in von Ihnen entwickelten Anwendungen verteilen dürfen, wenn Sie die
folgenden Bestimmungen einhalten.
i. Recht zur Nutzung und zum Vertrieb.
• Sie dürfen die Objektcodeform der Software kopieren und verteilen.
• Vertrieb durch Dritte. Sie sind berechtigt, Distributoren Ihrer Anwendungen zu erlauben,
den vertreibbaren Code als Teil dieser Anwendungen zu kopieren und zu vertreiben.
ii. Vertriebsbedingungen. Für vertreibbaren Code, den Sie vertreiben, sind Sie
verpflichtet:
• den vertreibbaren Code in Ihren Anwendungen zu verwenden und nicht als
eigenständige Verteilung;
• von Händlern und externen Endbenutzern die Zustimmung zu Bedingungen zu verlangen,
die einen mindestens gleichwertigen Schutz für den Code bieten wie diese Vereinbarung;
und
• Microsoft von allen Ansprüchen und Kosten, einschließlich Anwaltsgebühren, freistellen
und gegen alle Ansprüche verteidigen, die mit dem Vertrieb oder der Nutzung Ihrer
Anwendungen in Zusammenhang stehen, außer insoweit sich ein Anspruch ausschließlich
auf den unveränderten vertreibbaren Code stützt.
iii. Vertriebsbeschränkungen. Sie sind nicht dazu berechtigt:
• die Marken von Microsoft in den Namen Ihrer Anwendungen oder auf eine Weise zu
verwenden, die nahelegt, dass Ihre Anwendungen von Microsoft stammen oder von
Microsoft empfohlen werden, oder
• den Quellcode von vertreibbarem Code so zu ändern oder zu vertreiben, dass irgendein
Teil von ihm einer ausgeschlossenen Lizenz unterliegt. Bei einer „ausgeklammerten
Lizenz" handelt es sich um eine Lizenz, die als Bedingung für Nutzung, Änderung oder
Verteilung des Codes erfordert, dass (a) diese in Quellcodeform offengelegt oder verteilt
wird oder (b) andere das Recht haben, dieselbe zu ändern.
4. DATEN.
a. Datenerfassung. Die Software erhebt möglicherweise Informationen über Sie und Ihre
Verwendung der Software und sendet diese an Microsoft. Microsoft kann diese Informationen
verwenden, um unsere Produkte und Dienste bereitzustellen und zu verbessern. Sie können sich
gegen viele dieser Szenarios entscheiden, jedoch nicht gegen alle, wie in der
Softwaredokumentation beschrieben. Die Software besitzt auch einige Funktionen, mit denen Sie
und Microsoft Informationen über die Nutzer Ihrer Anwendungen sammeln können. Wenn Sie
diese Funktionen nutzen, müssen Sie die geltenden Gesetze einhalten, einschließlich der
Bereitstellung entsprechender Hinweise für Nutzer Ihrer Anwendungen zusammen mit einer
Kopie der Datenschutzerklärung von Microsoft. Unsere Datenschutzerklärung finden Sie unter
https://go.microsoft.com/fwlink/?LinkID=824704. Mehr über Datensammlung und deren Nutzung
können Sie in der Softwaredokumentation und in unserer Datenschutzerklärung erfahren. Durch
die Nutzung der Software erklären Sie sich mit diesen Praktiken einverstanden.
b. Verarbeitung personenbezogener Daten. Soweit Microsoft im Zusammenhang mit der
Software als Auftragsverarbeiter oder Unterauftragsverarbeiter von personenbezogenen Daten
auftritt, geht Microsoft im Rahmen der Datenschutz-Grundverordnung der Europäischen Union
zum 25. Mai 2018 allen Kunden gegenüber die Verpflichtungen gemäß den Bestimmungen für
Onlinedienste ein, die unter https://docs.microsoft.com/en-us/legal/gdpr verfügbar sind.
5. GÜLTIGKEITSBEREICH DER LIZENZ. Die Software wird lizenziert, nicht verkauft. Diese
Vereinbarung gewährt Ihnen lediglich bestimmte Rechte zur Nutzung der Software. Microsoft behält
sich alle anderen Rechte vor. Sie dürfen die Software nur wie in dieser Vereinbarung ausdrücklich
gestattet nutzen, es sei denn, das anwendbare Recht gibt Ihnen ungeachtet dieser Einschränkung
umfassendere Rechte. Dabei sind Sie verpflichtet, alle technischen Beschränkungen der Software
einzuhalten, die Ihnen nur spezielle Verwendungen gestatten. Sie sind nicht dazu berechtigt:
• technische Beschränkungen der Software zu umgehen;
• die Software zurückzuentwickeln, zu dekompilieren oder zu disassemblieren oder anderweitig zu
versuchen, den Quellcode für die Software abzuleiten, ausgenommen und in dem Maße, wie dies
in Lizenzierungsbedingungen für Dritte vorgesehen ist, die die Verwendung bestimmter Open-
Source-Komponenten regeln, die in der Software enthalten sein können;
• Mitteilungen der Firma Microsoft oder ihrer Lieferanten in der Software zu entfernen, zu
minimieren, zu blockieren oder zu verändern;
• die Software auf eine Weise zu verwenden, die gegen das Gesetz verstößt, oder
• die Software gemeinsam zu nutzen, zu veröffentlichen oder zu verleihen oder die Software als
eigenständiges Angebot für Nutzung durch andere bereitzustellen.
6. AUSFUHRBESCHRÄNKUNGEN. Sie sind verpflichtet, alle nationalen und internationalen
Exportgesetze und Exportbestimmungen einzuhalten, die für die Software gelten, welche auch
Beschränkungen in Bezug auf Bestimmungsorte, Endbenutzer und die Endnutzung enthalten. Weitere
Informationen zu Ausfuhrbeschränkungen finden Sie unter www.microsoft.com/exporting.
7. SUPPORTSERVICES. Da diese Software „wie besehen“ verkauft wird, stellen wir für diese
möglicherweise keine Supportleistungen zur Verfügung.
8. GESAMTER VERTRAG. Diese Vereinbarung sowie die Bestimmungen für von Ihnen genutzte
Ergänzungen, Aktualisierungen, internetbasierte Dienste und Supportleistungen stellen die
Gesamtvereinbarung über die Software und die Supportleistungen dar.
9. ANWENDBARES RECHT. Wenn Sie die Software in den USA erworben haben, regeln die Gesetze
des Bundesstaates Washington die Auslegung dieser Vereinbarung sowie Ansprüche, die aus einer
Vertragsverletzung entstehen, und die Gesetze des Bundesstaates, in dem Sie leben, regeln alle
anderen Ansprüche. Wenn Sie die Software in einem anderen Land erworben haben, gelten die
Gesetze dieses Landes.
10. VERBRAUCHERRECHTE, REGIONALE VARIANTEN. Diese Vereinbarung beschreibt bestimmte
Rechte. Möglicherweise sehen die Gesetze Ihres Staats oder Lands andere Rechte vor, einschließlich
Verbraucherrechte. Möglicherweise verfügen Sie unabhängig von Ihrer Geschäftsbeziehung mit
Microsoft außerdem über Rechte im Hinblick auf den Lizenzgeber, von dem Sie die Software
erworben haben. Dieser Vertrag ändert diese anderen Rechte nicht, wenn die Gesetze Ihres
Bundesstaates oder Lands dies nicht gestatten. Wenn Sie die Software beispielsweise in einer der
unten genannten Regionen erworben haben oder zwingendes Recht des Landes Anwendung findet,
gelten die folgenden Bestimmungen für Sie:
a) Australien. Für Sie gelten die gesetzlichen Garantien gemäß des Australian Consumer Law und
diese Vereinbarung hat in keiner Weise die Absicht, diese Rechte einzuschränken.
b) Kanada. Sofern Sie diese Software in Kanada erwarben, können Sie ggf. den Empfang von
Aktualisierungen durch die Deaktivierung der automatischen Aktualisierungsfunktion einstellen
lassen bzw. durch die Trennung Ihres Gerätes vom Internet (sofern Sie das Gerät erneut
verbinden, wird die Software weiterhin Aktualisierungen aus dem Internet abfragen und zu
installieren versuchen) oder durch die Deinstallation der Software. Hinweise zur Deaktivierung
der Aktualisierungsfunktion bei Ihrem spezifischen Gerät oder Ihrer spezifischen Software sind
ggf. im Besonderen auch der jeweiligen Produktdokumentation zu entnehmen.
c) Deutschland und Österreich.
(i) Gewährleistung. Die Software wird im Wesentlichen so funktionieren, wie in den sie
begleitenden Microsoft-Unterlagen beschrieben. Jedoch gewährt Microsoft keine vertragliche
Garantie in Bezug auf die Software.
(ii) Haftungsbeschränkung. Bei Vorsatz, grober Fahrlässigkeit und Ansprüchen nach dem
Produkthaftungsgesetz sowie bei Tod oder Körperverletzung haftet Microsoft nach den
gesetzlichen Bestimmungen.
Vorbehaltlich der vorstehenden Klausel (ii) haftet Microsoft bei leichter Fahrlässigkeit nur, wenn das
Unternehmen eine wesentliche Vertragspflicht verletzt, deren Erfüllung die ordnungsgemäße
Durchführung dieses Vertrages überhaupt erst ermöglicht, deren Verletzung die Erreichung des
Vertragszwecks gefährdet und auf deren Einhaltung eine Partei regelmäßig vertrauen darf (sog.
„Kardinalpflichten“). In anderen Fällen von leichter Fahrlässigkeit haftet Microsoft nicht.
11. AUSSCHLUSS VON GARANTIEN. DIE SOFTWARE WIRD „WIE BESEHEN“ LIZENZIERT. SIE
TRAGEN DAS MIT DER VERWENDUNG VERBUNDENE RISIKO. MICROSOFT GEWÄHRT
KEINE AUSDRÜCKLICHEN GEWÄHRLEISTUNGEN ODER GARANTIEN. IN DEM NACH
IHREM ÖRTLICH ANWENDBAREN RECHT ZULÄSSIGEN UMFANG SCHLIESST MICROSOFT
KONKLUDENTE GARANTIEN DER HANDELSÜBLICHKEIT, EIGNUNG FÜR EINEN
BESTIMMTEN ZWECK UND NICHTVERLETZUNG VON RECHTEN DRITTER AUS.
12. BESCHRÄNKUNG UND AUSSCHLUSS VON ABHILFEANSPRÜCHEN UND SCHADENERSATZ.
SIE KÖNNEN VON MICROSOFT UND DEREN LIEFERANTEN NUR EINEN ERSATZ FÜR
DIREKTE SCHÄDEN BIS ZU EINEM BETRAG VON 5,00 US-DOLLAR ERHALTEN. SIE
KÖNNEN KEINEN ERSATZ FÜR ANDERE SCHÄDEN ERHALTEN, EINSCHLIESSLICH
FOLGESCHÄDEN, SCHÄDEN AUS ENTGANGENEM GEWINN, SPEZIELLER, INDIREKTER
ODER ZUFÄLLIGER SCHÄDEN.
Diese Einschränkung gilt für (a) jeden Gegenstand im Zusammenhang mit der Software, Diensten,
Inhalten (einschließlich Code) auf Internetseiten von Drittanbietern oder Anwendungen von Dritten
und (b) Ansprüche aus Vertragsverletzungen, Verletzungen der Garantie oder der Gewährleistung,
verschuldensunabhängiger Haftung, Fahrlässigkeit oder anderen unerlaubten Handlungen im durch
das anwendbare Recht zugelassenen Umfang.
Sie hat auch dann Gültigkeit, wenn Microsoft von der Möglichkeit der Schäden gewusst hat oder hätte
wissen müssen. Obige Beschränkung und obiger Ausschluss gelten möglicherweise nicht für Sie, weil
Ihr Staat oder Land den Ausschluss oder die Beschränkung von zufälligen Schäden, Folgeschäden
oder sonstigen Schäden nicht gestattet.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,127 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT .NET LIBRARY
These license terms are an agreement between Microsoft Corporation (or based on where you live, one
of its affiliates) and you. They apply to the software named above. The terms also apply to any Microsoft
services or updates for the software, except to the extent those have different terms.
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.
1. INSTALLATION AND USE RIGHTS.
You may install and use any number of copies of the software to design, develop and test youre
applications. You may modify, copy, distribute or deploy any .js files contained in the software as
part of your applications.
2. THIRD PARTY COMPONENTS. The software may include third party components with separate legal
notices or governed by other agreements, as may be described in the ThirdPartyNotices file(s)
accompanying the software.
3. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
a. DISTRIBUTABLE CODE. In addition to the .js files described above, the software is comprised
of Distributable Code. “Distributable Code” is code that you are permitted to distribute in
programs you develop if you comply with the terms below.
i. Right to Use and Distribute.
• You may copy and distribute the object code form of the software.
• Third Party Distribution. You may permit distributors of your programs to copy and
distribute the Distributable Code as part of those programs.
ii. Distribution Requirements. For any Distributable Code you distribute, you must
• use the Distributable Code in your programs and not as a standalone distribution;
• require distributors and external end users to agree to terms that protect it at least as
much as this agreement;
• display your valid copyright notice on your programs; and
• indemnify, defend, and hold harmless Microsoft from any claims, including attorneys
fees, related to the distribution or use of your applications, except to the extent that any
claim is based solely on the Distributable Code.
iii. Distribution Restrictions. You may not
• alter any copyright, trademark or patent notice in the Distributable Code;
• use Microsofts trademarks in your programs names or in a way that suggests your
programs come from or are endorsed by Microsoft;
• include Distributable Code in malicious, deceptive or unlawful programs; or
• modify or distribute the source code of any Distributable Code so that any part of it
becomes subject to an Excluded License. An Excluded License is one that requires, as a
condition of use, modification or distribution, that
• the code be disclosed or distributed in source code form; or
• others have the right to modify it.
4. DATA.
a. Data Collection. The software may collect information about you and your use of the software,
and send that to Microsoft. Microsoft may use this information to provide services and improve
our products and services. You may opt-out of many of these scenarios, but not all, as described
in the product documentation. There are also some features in the software that may enable
you and Microsoft to collect data from users of your applications. If you use these features, you
must comply with applicable law, including providing appropriate notices to users of your
applications together with a copy of Microsofts privacy statement. Our privacy statement is
located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data
collection and use in the help documentation and our privacy statement. Your use of the software
operates as your consent to these practices.
b. Processing of Personal Data. To the extent Microsoft is a processor or subprocessor of
personal data in connection with the software, Microsoft makes the commitments in the
European Union General Data Protection Regulation Terms of the Online Services Terms to all
customers effective May 25, 2018, at http://go.microsoft.com/?linkid=9840733.
5. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights
to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights
despite this limitation, you may use the software only as expressly permitted in this agreement. In
doing so, you must comply with any technical limitations in the software that only allow you to use it
in certain ways. You may not
• work around any technical limitations in the software;
• reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the
source code for the software, except and to the extent required by third party licensing terms
governing use of certain open source components that may be included in the software;
• remove, minimize, block or modify any notices of Microsoft or its suppliers in the software;
• use the software in any way that is against the law; or
• share, publish, rent or lease the software, provide the software as a stand-alone offering for
others to use, or transfer the software or this agreement to any third party.
6. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall
the software.
7. DOCUMENTATION. Any person that has valid access to your computer or internal network may
copy and use the documentation for your internal, reference purposes.
8. EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and
regulations that apply to the software, which include restrictions on destinations, end users, and end
use. For further information on export restrictions, visit www.microsoft.com/exporting.
9. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
10. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based
services and support services that you use, are the entire agreement for the software and support
services.
11. APPLICABLE LAW. If you acquired the software in the United States, Washington law applies to
interpretation of and claims for breach of this agreement, and the laws of the state where you live
apply to all other claims. If you acquired the software in any other country, its laws apply.
12. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights.
You may have other rights, including consumer rights, under the laws of your state or country.
Separate and apart from your relationship with Microsoft, you may also have rights with respect to
the party from which you acquired the software. This agreement does not change those other rights
if the laws of your state or country do not permit it to do so. For example, if you acquired the
software in one of the below regions, or mandatory country law applies, then the following provisions
apply to you:
a) Australia. You have statutory guarantees under the Australian Consumer Law and nothing in
this agreement is intended to affect those rights.
b) Canada. If you acquired this software in Canada, you may stop receiving updates by turning off
the automatic update feature, disconnecting your device from the Internet (if and when you re-
connect to the Internet, however, the software will resume checking for and installing updates),
or uninstalling the software. The product documentation, if any, may also specify how to turn off
updates for your specific device or software.
c) Germany and Austria.
(i) Warranty. The software will perform substantially as described in any Microsoft
materials that accompany it. However, Microsoft gives no contractual guarantee in relation to the
software.
(ii) Limitation of Liability. In case of intentional conduct, gross negligence, claims based
on the Product Liability Act, as well as in case of death or personal or physical injury, Microsoft is
liable according to the statutory law.
Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft is in
breach of such material contractual obligations, the fulfillment of which facilitate the due
performance of this agreement, the breach of which would endanger the purpose of this agreement
and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In
other cases of slight negligence, Microsoft will not be liable for slight negligence
13. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK
OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR
CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT
EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON-INFRINGEMENT.
14. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER
FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU
CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS,
SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
This limitation applies to (a) anything related to the software, services, content (including code) on
third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of
warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by
applicable law.
It also applies even if Microsoft knew or should have known about the possibility of the damages.
The above limitation or exclusion may not apply to you because your state or country may not allow
the exclusion or limitation of incidental, consequential or other damages.
Please note: As this software is distributed in Quebec, Canada, some of the clauses in this
agreement are provided below in French.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,127 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT .NET LIBRARY
These license terms are an agreement between Microsoft Corporation (or based on where you live, one
of its affiliates) and you. They apply to the software named above. The terms also apply to any Microsoft
services or updates for the software, except to the extent those have different terms.
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.
1. INSTALLATION AND USE RIGHTS.
You may install and use any number of copies of the software to design, develop and test youre
applications. You may modify, copy, distribute or deploy any .js files contained in the software as
part of your applications.
2. THIRD PARTY COMPONENTS. The software may include third party components with separate legal
notices or governed by other agreements, as may be described in the ThirdPartyNotices file(s)
accompanying the software.
3. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
a. DISTRIBUTABLE CODE. In addition to the .js files described above, the software is comprised
of Distributable Code. “Distributable Code” is code that you are permitted to distribute in
programs you develop if you comply with the terms below.
i. Right to Use and Distribute.
• You may copy and distribute the object code form of the software.
• Third Party Distribution. You may permit distributors of your programs to copy and
distribute the Distributable Code as part of those programs.
ii. Distribution Requirements. For any Distributable Code you distribute, you must
• use the Distributable Code in your programs and not as a standalone distribution;
• require distributors and external end users to agree to terms that protect it at least as
much as this agreement;
• display your valid copyright notice on your programs; and
• indemnify, defend, and hold harmless Microsoft from any claims, including attorneys
fees, related to the distribution or use of your applications, except to the extent that any
claim is based solely on the Distributable Code.
iii. Distribution Restrictions. You may not
• alter any copyright, trademark or patent notice in the Distributable Code;
• use Microsofts trademarks in your programs names or in a way that suggests your
programs come from or are endorsed by Microsoft;
• include Distributable Code in malicious, deceptive or unlawful programs; or
• modify or distribute the source code of any Distributable Code so that any part of it
becomes subject to an Excluded License. An Excluded License is one that requires, as a
condition of use, modification or distribution, that
• the code be disclosed or distributed in source code form; or
• others have the right to modify it.
4. DATA.
a. Data Collection. The software may collect information about you and your use of the software,
and send that to Microsoft. Microsoft may use this information to provide services and improve
our products and services. You may opt-out of many of these scenarios, but not all, as described
in the product documentation. There are also some features in the software that may enable
you and Microsoft to collect data from users of your applications. If you use these features, you
must comply with applicable law, including providing appropriate notices to users of your
applications together with a copy of Microsofts privacy statement. Our privacy statement is
located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data
collection and use in the help documentation and our privacy statement. Your use of the software
operates as your consent to these practices.
b. Processing of Personal Data. To the extent Microsoft is a processor or subprocessor of
personal data in connection with the software, Microsoft makes the commitments in the
European Union General Data Protection Regulation Terms of the Online Services Terms to all
customers effective May 25, 2018, at http://go.microsoft.com/?linkid=9840733.
5. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights
to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights
despite this limitation, you may use the software only as expressly permitted in this agreement. In
doing so, you must comply with any technical limitations in the software that only allow you to use it
in certain ways. You may not
• work around any technical limitations in the software;
• reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the
source code for the software, except and to the extent required by third party licensing terms
governing use of certain open source components that may be included in the software;
• remove, minimize, block or modify any notices of Microsoft or its suppliers in the software;
• use the software in any way that is against the law; or
• share, publish, rent or lease the software, provide the software as a stand-alone offering for
others to use, or transfer the software or this agreement to any third party.
6. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall
the software.
7. DOCUMENTATION. Any person that has valid access to your computer or internal network may
copy and use the documentation for your internal, reference purposes.
8. EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and
regulations that apply to the software, which include restrictions on destinations, end users, and end
use. For further information on export restrictions, visit www.microsoft.com/exporting.
9. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
10. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based
services and support services that you use, are the entire agreement for the software and support
services.
11. APPLICABLE LAW. If you acquired the software in the United States, Washington law applies to
interpretation of and claims for breach of this agreement, and the laws of the state where you live
apply to all other claims. If you acquired the software in any other country, its laws apply.
12. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights.
You may have other rights, including consumer rights, under the laws of your state or country.
Separate and apart from your relationship with Microsoft, you may also have rights with respect to
the party from which you acquired the software. This agreement does not change those other rights
if the laws of your state or country do not permit it to do so. For example, if you acquired the
software in one of the below regions, or mandatory country law applies, then the following provisions
apply to you:
a) Australia. You have statutory guarantees under the Australian Consumer Law and nothing in
this agreement is intended to affect those rights.
b) Canada. If you acquired this software in Canada, you may stop receiving updates by turning off
the automatic update feature, disconnecting your device from the Internet (if and when you re-
connect to the Internet, however, the software will resume checking for and installing updates),
or uninstalling the software. The product documentation, if any, may also specify how to turn off
updates for your specific device or software.
c) Germany and Austria.
(i) Warranty. The software will perform substantially as described in any Microsoft
materials that accompany it. However, Microsoft gives no contractual guarantee in relation to the
software.
(ii) Limitation of Liability. In case of intentional conduct, gross negligence, claims based
on the Product Liability Act, as well as in case of death or personal or physical injury, Microsoft is
liable according to the statutory law.
Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft is in
breach of such material contractual obligations, the fulfillment of which facilitate the due
performance of this agreement, the breach of which would endanger the purpose of this agreement
and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In
other cases of slight negligence, Microsoft will not be liable for slight negligence
13. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK
OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR
CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT
EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON-INFRINGEMENT.
14. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER
FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU
CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS,
SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
This limitation applies to (a) anything related to the software, services, content (including code) on
third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of
warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by
applicable law.
It also applies even if Microsoft knew or should have known about the possibility of the damages.
The above limitation or exclusion may not apply to you because your state or country may not allow
the exclusion or limitation of incidental, consequential or other damages.
Please note: As this software is distributed in Quebec, Canada, some of the clauses in this
agreement are provided below in French.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,141 @@
MICROSOFT-SOFTWARE-LIZENZBEDINGUNGEN
MICROSOFT .NET-BIBLIOTHEK
Bei diesen Lizenzbestimmungen handelt es sich um eine Vereinbarung zwischen Ihnen und der Microsoft
Corporation (oder je nach Ihrem Wohnsitz, einem ihrer Affiliate-Partner). Sie gelten für die oben
angeführte Software. Die Bestimmungen gelten ebenso für jegliche von Microsoft angebotenen Dienste
oder Updates für die Software, sofern diesen keine anderen Bestimmungen beiliegen.
WENN SIE DIESE LIZENZBESTIMMUNGEN EINHALTEN, VERFÜGEN SIE ÜBER DIE
NACHFOLGEND AUFGEFÜHRTEN RECHTE:
1. INSTALLATIONS- UND NUTZUNGSRECHTE.
Sie sind berechtigt, eine beliebige Anzahl an Kopien der Software zum Entwickeln und Testen Ihrer
Anwendungen zu installieren und zu verwenden.
2. KOMPONENTEN DRITTER. Diese Software kann Komponenten Dritter enthalten, die gesonderten
rechtlichen Anmerkungen oder anderen Verträgen unterliegen, wie in den der Software beiliegenden
ThirdPartyNotices-Dateien ggf. beschrieben ist.
3. ZUSÄTZLICHE LIZENZANFORDERUNGEN UND/ODER NUTZUNGSRECHTE.
a. VERTREIBBARER CODE. Die Software besteht aus vertreibbarem Code. Der „vertreibbare
Code“ ist Code, den Sie in von Ihnen entwickelten Anwendungen verteilen dürfen, wenn Sie die
folgenden Bestimmungen einhalten.
i. Recht zur Nutzung und zum Vertrieb.
• Sie dürfen die Objektcodeform der Software kopieren und verteilen.
• Vertrieb durch Dritte. Sie sind berechtigt, Distributoren Ihrer Anwendungen zu erlauben,
den vertreibbaren Code als Teil dieser Anwendungen zu kopieren und zu vertreiben.
ii. Vertriebsbedingungen. Für vertreibbaren Code, den Sie vertreiben, sind Sie
verpflichtet:
• den vertreibbaren Code in Ihren Anwendungen zu verwenden und nicht als
eigenständige Verteilung;
• von Händlern und externen Endbenutzern die Zustimmung zu Bedingungen zu verlangen,
die einen mindestens gleichwertigen Schutz für den Code bieten wie diese Vereinbarung;
und
• Microsoft von allen Ansprüchen und Kosten, einschließlich Anwaltsgebühren, freistellen
und gegen alle Ansprüche verteidigen, die mit dem Vertrieb oder der Nutzung Ihrer
Anwendungen in Zusammenhang stehen, außer insoweit sich ein Anspruch ausschließlich
auf den unveränderten vertreibbaren Code stützt.
iii. Vertriebsbeschränkungen. Sie sind nicht dazu berechtigt:
• die Marken von Microsoft in den Namen Ihrer Anwendungen oder auf eine Weise zu
verwenden, die nahelegt, dass Ihre Anwendungen von Microsoft stammen oder von
Microsoft empfohlen werden, oder
• den Quellcode von vertreibbarem Code so zu ändern oder zu vertreiben, dass irgendein
Teil von ihm einer ausgeschlossenen Lizenz unterliegt. Bei einer „ausgeklammerten
Lizenz" handelt es sich um eine Lizenz, die als Bedingung für Nutzung, Änderung oder
Verteilung des Codes erfordert, dass (a) diese in Quellcodeform offengelegt oder verteilt
wird oder (b) andere das Recht haben, dieselbe zu ändern.
4. DATEN.
a. Datenerfassung. Die Software erhebt möglicherweise Informationen über Sie und Ihre
Verwendung der Software und sendet diese an Microsoft. Microsoft kann diese Informationen
verwenden, um unsere Produkte und Dienste bereitzustellen und zu verbessern. Sie können sich
gegen viele dieser Szenarios entscheiden, jedoch nicht gegen alle, wie in der
Softwaredokumentation beschrieben. Die Software besitzt auch einige Funktionen, mit denen Sie
und Microsoft Informationen über die Nutzer Ihrer Anwendungen sammeln können. Wenn Sie
diese Funktionen nutzen, müssen Sie die geltenden Gesetze einhalten, einschließlich der
Bereitstellung entsprechender Hinweise für Nutzer Ihrer Anwendungen zusammen mit einer
Kopie der Datenschutzerklärung von Microsoft. Unsere Datenschutzerklärung finden Sie unter
https://go.microsoft.com/fwlink/?LinkID=824704. Mehr über Datensammlung und deren Nutzung
können Sie in der Softwaredokumentation und in unserer Datenschutzerklärung erfahren. Durch
die Nutzung der Software erklären Sie sich mit diesen Praktiken einverstanden.
b. Verarbeitung personenbezogener Daten. Soweit Microsoft im Zusammenhang mit der
Software als Auftragsverarbeiter oder Unterauftragsverarbeiter von personenbezogenen Daten
auftritt, geht Microsoft im Rahmen der Datenschutz-Grundverordnung der Europäischen Union
zum 25. Mai 2018 allen Kunden gegenüber die Verpflichtungen gemäß den Bestimmungen für
Onlinedienste ein, die unter https://docs.microsoft.com/en-us/legal/gdpr verfügbar sind.
5. GÜLTIGKEITSBEREICH DER LIZENZ. Die Software wird lizenziert, nicht verkauft. Diese
Vereinbarung gewährt Ihnen lediglich bestimmte Rechte zur Nutzung der Software. Microsoft behält
sich alle anderen Rechte vor. Sie dürfen die Software nur wie in dieser Vereinbarung ausdrücklich
gestattet nutzen, es sei denn, das anwendbare Recht gibt Ihnen ungeachtet dieser Einschränkung
umfassendere Rechte. Dabei sind Sie verpflichtet, alle technischen Beschränkungen der Software
einzuhalten, die Ihnen nur spezielle Verwendungen gestatten. Sie sind nicht dazu berechtigt:
• technische Beschränkungen der Software zu umgehen;
• die Software zurückzuentwickeln, zu dekompilieren oder zu disassemblieren oder anderweitig zu
versuchen, den Quellcode für die Software abzuleiten, ausgenommen und in dem Maße, wie dies
in Lizenzierungsbedingungen für Dritte vorgesehen ist, die die Verwendung bestimmter Open-
Source-Komponenten regeln, die in der Software enthalten sein können;
• Mitteilungen der Firma Microsoft oder ihrer Lieferanten in der Software zu entfernen, zu
minimieren, zu blockieren oder zu verändern;
• die Software auf eine Weise zu verwenden, die gegen das Gesetz verstößt, oder
• die Software gemeinsam zu nutzen, zu veröffentlichen oder zu verleihen oder die Software als
eigenständiges Angebot für Nutzung durch andere bereitzustellen.
6. AUSFUHRBESCHRÄNKUNGEN. Sie sind verpflichtet, alle nationalen und internationalen
Exportgesetze und Exportbestimmungen einzuhalten, die für die Software gelten, welche auch
Beschränkungen in Bezug auf Bestimmungsorte, Endbenutzer und die Endnutzung enthalten. Weitere
Informationen zu Ausfuhrbeschränkungen finden Sie unter www.microsoft.com/exporting.
7. SUPPORTSERVICES. Da diese Software „wie besehen“ verkauft wird, stellen wir für diese
möglicherweise keine Supportleistungen zur Verfügung.
8. GESAMTER VERTRAG. Diese Vereinbarung sowie die Bestimmungen für von Ihnen genutzte
Ergänzungen, Aktualisierungen, internetbasierte Dienste und Supportleistungen stellen die
Gesamtvereinbarung über die Software und die Supportleistungen dar.
9. ANWENDBARES RECHT. Wenn Sie die Software in den USA erworben haben, regeln die Gesetze
des Bundesstaates Washington die Auslegung dieser Vereinbarung sowie Ansprüche, die aus einer
Vertragsverletzung entstehen, und die Gesetze des Bundesstaates, in dem Sie leben, regeln alle
anderen Ansprüche. Wenn Sie die Software in einem anderen Land erworben haben, gelten die
Gesetze dieses Landes.
10. VERBRAUCHERRECHTE, REGIONALE VARIANTEN. Diese Vereinbarung beschreibt bestimmte
Rechte. Möglicherweise sehen die Gesetze Ihres Staats oder Lands andere Rechte vor, einschließlich
Verbraucherrechte. Möglicherweise verfügen Sie unabhängig von Ihrer Geschäftsbeziehung mit
Microsoft außerdem über Rechte im Hinblick auf den Lizenzgeber, von dem Sie die Software
erworben haben. Dieser Vertrag ändert diese anderen Rechte nicht, wenn die Gesetze Ihres
Bundesstaates oder Lands dies nicht gestatten. Wenn Sie die Software beispielsweise in einer der
unten genannten Regionen erworben haben oder zwingendes Recht des Landes Anwendung findet,
gelten die folgenden Bestimmungen für Sie:
a) Australien. Für Sie gelten die gesetzlichen Garantien gemäß des Australian Consumer Law und
diese Vereinbarung hat in keiner Weise die Absicht, diese Rechte einzuschränken.
b) Kanada. Sofern Sie diese Software in Kanada erwarben, können Sie ggf. den Empfang von
Aktualisierungen durch die Deaktivierung der automatischen Aktualisierungsfunktion einstellen
lassen bzw. durch die Trennung Ihres Gerätes vom Internet (sofern Sie das Gerät erneut
verbinden, wird die Software weiterhin Aktualisierungen aus dem Internet abfragen und zu
installieren versuchen) oder durch die Deinstallation der Software. Hinweise zur Deaktivierung
der Aktualisierungsfunktion bei Ihrem spezifischen Gerät oder Ihrer spezifischen Software sind
ggf. im Besonderen auch der jeweiligen Produktdokumentation zu entnehmen.
c) Deutschland und Österreich.
(i) Gewährleistung. Die Software wird im Wesentlichen so funktionieren, wie in den sie
begleitenden Microsoft-Unterlagen beschrieben. Jedoch gewährt Microsoft keine vertragliche
Garantie in Bezug auf die Software.
(ii) Haftungsbeschränkung. Bei Vorsatz, grober Fahrlässigkeit und Ansprüchen nach dem
Produkthaftungsgesetz sowie bei Tod oder Körperverletzung haftet Microsoft nach den
gesetzlichen Bestimmungen.
Vorbehaltlich der vorstehenden Klausel (ii) haftet Microsoft bei leichter Fahrlässigkeit nur, wenn das
Unternehmen eine wesentliche Vertragspflicht verletzt, deren Erfüllung die ordnungsgemäße
Durchführung dieses Vertrages überhaupt erst ermöglicht, deren Verletzung die Erreichung des
Vertragszwecks gefährdet und auf deren Einhaltung eine Partei regelmäßig vertrauen darf (sog.
„Kardinalpflichten“). In anderen Fällen von leichter Fahrlässigkeit haftet Microsoft nicht.
11. AUSSCHLUSS VON GARANTIEN. DIE SOFTWARE WIRD „WIE BESEHEN“ LIZENZIERT. SIE
TRAGEN DAS MIT DER VERWENDUNG VERBUNDENE RISIKO. MICROSOFT GEWÄHRT
KEINE AUSDRÜCKLICHEN GEWÄHRLEISTUNGEN ODER GARANTIEN. IN DEM NACH
IHREM ÖRTLICH ANWENDBAREN RECHT ZULÄSSIGEN UMFANG SCHLIESST MICROSOFT
KONKLUDENTE GARANTIEN DER HANDELSÜBLICHKEIT, EIGNUNG FÜR EINEN
BESTIMMTEN ZWECK UND NICHTVERLETZUNG VON RECHTEN DRITTER AUS.
12. BESCHRÄNKUNG UND AUSSCHLUSS VON ABHILFEANSPRÜCHEN UND SCHADENERSATZ.
SIE KÖNNEN VON MICROSOFT UND DEREN LIEFERANTEN NUR EINEN ERSATZ FÜR
DIREKTE SCHÄDEN BIS ZU EINEM BETRAG VON 5,00 US-DOLLAR ERHALTEN. SIE
KÖNNEN KEINEN ERSATZ FÜR ANDERE SCHÄDEN ERHALTEN, EINSCHLIESSLICH
FOLGESCHÄDEN, SCHÄDEN AUS ENTGANGENEM GEWINN, SPEZIELLER, INDIREKTER
ODER ZUFÄLLIGER SCHÄDEN.
Diese Einschränkung gilt für (a) jeden Gegenstand im Zusammenhang mit der Software, Diensten,
Inhalten (einschließlich Code) auf Internetseiten von Drittanbietern oder Anwendungen von Dritten
und (b) Ansprüche aus Vertragsverletzungen, Verletzungen der Garantie oder der Gewährleistung,
verschuldensunabhängiger Haftung, Fahrlässigkeit oder anderen unerlaubten Handlungen im durch
das anwendbare Recht zugelassenen Umfang.
Sie hat auch dann Gültigkeit, wenn Microsoft von der Möglichkeit der Schäden gewusst hat oder hätte
wissen müssen. Obige Beschränkung und obiger Ausschluss gelten möglicherweise nicht für Sie, weil
Ihr Staat oder Land den Ausschluss oder die Beschränkung von zufälligen Schäden, Folgeschäden
oder sonstigen Schäden nicht gestattet.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</configuration>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,127 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT .NET LIBRARY
These license terms are an agreement between Microsoft Corporation (or based on where you live, one
of its affiliates) and you. They apply to the software named above. The terms also apply to any Microsoft
services or updates for the software, except to the extent those have different terms.
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.
1. INSTALLATION AND USE RIGHTS.
You may install and use any number of copies of the software to design, develop and test youre
applications. You may modify, copy, distribute or deploy any .js files contained in the software as
part of your applications.
2. THIRD PARTY COMPONENTS. The software may include third party components with separate legal
notices or governed by other agreements, as may be described in the ThirdPartyNotices file(s)
accompanying the software.
3. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
a. DISTRIBUTABLE CODE. In addition to the .js files described above, the software is comprised
of Distributable Code. “Distributable Code” is code that you are permitted to distribute in
programs you develop if you comply with the terms below.
i. Right to Use and Distribute.
• You may copy and distribute the object code form of the software.
• Third Party Distribution. You may permit distributors of your programs to copy and
distribute the Distributable Code as part of those programs.
ii. Distribution Requirements. For any Distributable Code you distribute, you must
• use the Distributable Code in your programs and not as a standalone distribution;
• require distributors and external end users to agree to terms that protect it at least as
much as this agreement;
• display your valid copyright notice on your programs; and
• indemnify, defend, and hold harmless Microsoft from any claims, including attorneys
fees, related to the distribution or use of your applications, except to the extent that any
claim is based solely on the Distributable Code.
iii. Distribution Restrictions. You may not
• alter any copyright, trademark or patent notice in the Distributable Code;
• use Microsofts trademarks in your programs names or in a way that suggests your
programs come from or are endorsed by Microsoft;
• include Distributable Code in malicious, deceptive or unlawful programs; or
• modify or distribute the source code of any Distributable Code so that any part of it
becomes subject to an Excluded License. An Excluded License is one that requires, as a
condition of use, modification or distribution, that
• the code be disclosed or distributed in source code form; or
• others have the right to modify it.
4. DATA.
a. Data Collection. The software may collect information about you and your use of the software,
and send that to Microsoft. Microsoft may use this information to provide services and improve
our products and services. You may opt-out of many of these scenarios, but not all, as described
in the product documentation. There are also some features in the software that may enable
you and Microsoft to collect data from users of your applications. If you use these features, you
must comply with applicable law, including providing appropriate notices to users of your
applications together with a copy of Microsofts privacy statement. Our privacy statement is
located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data
collection and use in the help documentation and our privacy statement. Your use of the software
operates as your consent to these practices.
b. Processing of Personal Data. To the extent Microsoft is a processor or subprocessor of
personal data in connection with the software, Microsoft makes the commitments in the
European Union General Data Protection Regulation Terms of the Online Services Terms to all
customers effective May 25, 2018, at http://go.microsoft.com/?linkid=9840733.
5. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights
to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights
despite this limitation, you may use the software only as expressly permitted in this agreement. In
doing so, you must comply with any technical limitations in the software that only allow you to use it
in certain ways. You may not
• work around any technical limitations in the software;
• reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the
source code for the software, except and to the extent required by third party licensing terms
governing use of certain open source components that may be included in the software;
• remove, minimize, block or modify any notices of Microsoft or its suppliers in the software;
• use the software in any way that is against the law; or
• share, publish, rent or lease the software, provide the software as a stand-alone offering for
others to use, or transfer the software or this agreement to any third party.
6. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall
the software.
7. DOCUMENTATION. Any person that has valid access to your computer or internal network may
copy and use the documentation for your internal, reference purposes.
8. EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and
regulations that apply to the software, which include restrictions on destinations, end users, and end
use. For further information on export restrictions, visit www.microsoft.com/exporting.
9. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
10. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based
services and support services that you use, are the entire agreement for the software and support
services.
11. APPLICABLE LAW. If you acquired the software in the United States, Washington law applies to
interpretation of and claims for breach of this agreement, and the laws of the state where you live
apply to all other claims. If you acquired the software in any other country, its laws apply.
12. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights.
You may have other rights, including consumer rights, under the laws of your state or country.
Separate and apart from your relationship with Microsoft, you may also have rights with respect to
the party from which you acquired the software. This agreement does not change those other rights
if the laws of your state or country do not permit it to do so. For example, if you acquired the
software in one of the below regions, or mandatory country law applies, then the following provisions
apply to you:
a) Australia. You have statutory guarantees under the Australian Consumer Law and nothing in
this agreement is intended to affect those rights.
b) Canada. If you acquired this software in Canada, you may stop receiving updates by turning off
the automatic update feature, disconnecting your device from the Internet (if and when you re-
connect to the Internet, however, the software will resume checking for and installing updates),
or uninstalling the software. The product documentation, if any, may also specify how to turn off
updates for your specific device or software.
c) Germany and Austria.
(i) Warranty. The software will perform substantially as described in any Microsoft
materials that accompany it. However, Microsoft gives no contractual guarantee in relation to the
software.
(ii) Limitation of Liability. In case of intentional conduct, gross negligence, claims based
on the Product Liability Act, as well as in case of death or personal or physical injury, Microsoft is
liable according to the statutory law.
Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft is in
breach of such material contractual obligations, the fulfillment of which facilitate the due
performance of this agreement, the breach of which would endanger the purpose of this agreement
and the compliance with which a party may constantly trust in (so-called "cardinal obligations"). In
other cases of slight negligence, Microsoft will not be liable for slight negligence
13. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK
OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR
CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT
EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON-INFRINGEMENT.
14. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER
FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU
CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS,
SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
This limitation applies to (a) anything related to the software, services, content (including code) on
third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of
warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by
applicable law.
It also applies even if Microsoft knew or should have known about the possibility of the damages.
The above limitation or exclusion may not apply to you because your state or country may not allow
the exclusion or limitation of incidental, consequential or other damages.
Please note: As this software is distributed in Quebec, Canada, some of the clauses in this
agreement are provided below in French.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,141 @@
MICROSOFT-SOFTWARE-LIZENZBEDINGUNGEN
MICROSOFT .NET-BIBLIOTHEK
Bei diesen Lizenzbestimmungen handelt es sich um eine Vereinbarung zwischen Ihnen und der Microsoft
Corporation (oder je nach Ihrem Wohnsitz, einem ihrer Affiliate-Partner). Sie gelten für die oben
angeführte Software. Die Bestimmungen gelten ebenso für jegliche von Microsoft angebotenen Dienste
oder Updates für die Software, sofern diesen keine anderen Bestimmungen beiliegen.
WENN SIE DIESE LIZENZBESTIMMUNGEN EINHALTEN, VERFÜGEN SIE ÜBER DIE
NACHFOLGEND AUFGEFÜHRTEN RECHTE:
1. INSTALLATIONS- UND NUTZUNGSRECHTE.
Sie sind berechtigt, eine beliebige Anzahl an Kopien der Software zum Entwickeln und Testen Ihrer
Anwendungen zu installieren und zu verwenden.
2. KOMPONENTEN DRITTER. Diese Software kann Komponenten Dritter enthalten, die gesonderten
rechtlichen Anmerkungen oder anderen Verträgen unterliegen, wie in den der Software beiliegenden
ThirdPartyNotices-Dateien ggf. beschrieben ist.
3. ZUSÄTZLICHE LIZENZANFORDERUNGEN UND/ODER NUTZUNGSRECHTE.
a. VERTREIBBARER CODE. Die Software besteht aus vertreibbarem Code. Der „vertreibbare
Code“ ist Code, den Sie in von Ihnen entwickelten Anwendungen verteilen dürfen, wenn Sie die
folgenden Bestimmungen einhalten.
i. Recht zur Nutzung und zum Vertrieb.
• Sie dürfen die Objektcodeform der Software kopieren und verteilen.
• Vertrieb durch Dritte. Sie sind berechtigt, Distributoren Ihrer Anwendungen zu erlauben,
den vertreibbaren Code als Teil dieser Anwendungen zu kopieren und zu vertreiben.
ii. Vertriebsbedingungen. Für vertreibbaren Code, den Sie vertreiben, sind Sie
verpflichtet:
• den vertreibbaren Code in Ihren Anwendungen zu verwenden und nicht als
eigenständige Verteilung;
• von Händlern und externen Endbenutzern die Zustimmung zu Bedingungen zu verlangen,
die einen mindestens gleichwertigen Schutz für den Code bieten wie diese Vereinbarung;
und
• Microsoft von allen Ansprüchen und Kosten, einschließlich Anwaltsgebühren, freistellen
und gegen alle Ansprüche verteidigen, die mit dem Vertrieb oder der Nutzung Ihrer
Anwendungen in Zusammenhang stehen, außer insoweit sich ein Anspruch ausschließlich
auf den unveränderten vertreibbaren Code stützt.
iii. Vertriebsbeschränkungen. Sie sind nicht dazu berechtigt:
• die Marken von Microsoft in den Namen Ihrer Anwendungen oder auf eine Weise zu
verwenden, die nahelegt, dass Ihre Anwendungen von Microsoft stammen oder von
Microsoft empfohlen werden, oder
• den Quellcode von vertreibbarem Code so zu ändern oder zu vertreiben, dass irgendein
Teil von ihm einer ausgeschlossenen Lizenz unterliegt. Bei einer „ausgeklammerten
Lizenz" handelt es sich um eine Lizenz, die als Bedingung für Nutzung, Änderung oder
Verteilung des Codes erfordert, dass (a) diese in Quellcodeform offengelegt oder verteilt
wird oder (b) andere das Recht haben, dieselbe zu ändern.
4. DATEN.
a. Datenerfassung. Die Software erhebt möglicherweise Informationen über Sie und Ihre
Verwendung der Software und sendet diese an Microsoft. Microsoft kann diese Informationen
verwenden, um unsere Produkte und Dienste bereitzustellen und zu verbessern. Sie können sich
gegen viele dieser Szenarios entscheiden, jedoch nicht gegen alle, wie in der
Softwaredokumentation beschrieben. Die Software besitzt auch einige Funktionen, mit denen Sie
und Microsoft Informationen über die Nutzer Ihrer Anwendungen sammeln können. Wenn Sie
diese Funktionen nutzen, müssen Sie die geltenden Gesetze einhalten, einschließlich der
Bereitstellung entsprechender Hinweise für Nutzer Ihrer Anwendungen zusammen mit einer
Kopie der Datenschutzerklärung von Microsoft. Unsere Datenschutzerklärung finden Sie unter
https://go.microsoft.com/fwlink/?LinkID=824704. Mehr über Datensammlung und deren Nutzung
können Sie in der Softwaredokumentation und in unserer Datenschutzerklärung erfahren. Durch
die Nutzung der Software erklären Sie sich mit diesen Praktiken einverstanden.
b. Verarbeitung personenbezogener Daten. Soweit Microsoft im Zusammenhang mit der
Software als Auftragsverarbeiter oder Unterauftragsverarbeiter von personenbezogenen Daten
auftritt, geht Microsoft im Rahmen der Datenschutz-Grundverordnung der Europäischen Union
zum 25. Mai 2018 allen Kunden gegenüber die Verpflichtungen gemäß den Bestimmungen für
Onlinedienste ein, die unter https://docs.microsoft.com/en-us/legal/gdpr verfügbar sind.
5. GÜLTIGKEITSBEREICH DER LIZENZ. Die Software wird lizenziert, nicht verkauft. Diese
Vereinbarung gewährt Ihnen lediglich bestimmte Rechte zur Nutzung der Software. Microsoft behält
sich alle anderen Rechte vor. Sie dürfen die Software nur wie in dieser Vereinbarung ausdrücklich
gestattet nutzen, es sei denn, das anwendbare Recht gibt Ihnen ungeachtet dieser Einschränkung
umfassendere Rechte. Dabei sind Sie verpflichtet, alle technischen Beschränkungen der Software
einzuhalten, die Ihnen nur spezielle Verwendungen gestatten. Sie sind nicht dazu berechtigt:
• technische Beschränkungen der Software zu umgehen;
• die Software zurückzuentwickeln, zu dekompilieren oder zu disassemblieren oder anderweitig zu
versuchen, den Quellcode für die Software abzuleiten, ausgenommen und in dem Maße, wie dies
in Lizenzierungsbedingungen für Dritte vorgesehen ist, die die Verwendung bestimmter Open-
Source-Komponenten regeln, die in der Software enthalten sein können;
• Mitteilungen der Firma Microsoft oder ihrer Lieferanten in der Software zu entfernen, zu
minimieren, zu blockieren oder zu verändern;
• die Software auf eine Weise zu verwenden, die gegen das Gesetz verstößt, oder
• die Software gemeinsam zu nutzen, zu veröffentlichen oder zu verleihen oder die Software als
eigenständiges Angebot für Nutzung durch andere bereitzustellen.
6. AUSFUHRBESCHRÄNKUNGEN. Sie sind verpflichtet, alle nationalen und internationalen
Exportgesetze und Exportbestimmungen einzuhalten, die für die Software gelten, welche auch
Beschränkungen in Bezug auf Bestimmungsorte, Endbenutzer und die Endnutzung enthalten. Weitere
Informationen zu Ausfuhrbeschränkungen finden Sie unter www.microsoft.com/exporting.
7. SUPPORTSERVICES. Da diese Software „wie besehen“ verkauft wird, stellen wir für diese
möglicherweise keine Supportleistungen zur Verfügung.
8. GESAMTER VERTRAG. Diese Vereinbarung sowie die Bestimmungen für von Ihnen genutzte
Ergänzungen, Aktualisierungen, internetbasierte Dienste und Supportleistungen stellen die
Gesamtvereinbarung über die Software und die Supportleistungen dar.
9. ANWENDBARES RECHT. Wenn Sie die Software in den USA erworben haben, regeln die Gesetze
des Bundesstaates Washington die Auslegung dieser Vereinbarung sowie Ansprüche, die aus einer
Vertragsverletzung entstehen, und die Gesetze des Bundesstaates, in dem Sie leben, regeln alle
anderen Ansprüche. Wenn Sie die Software in einem anderen Land erworben haben, gelten die
Gesetze dieses Landes.
10. VERBRAUCHERRECHTE, REGIONALE VARIANTEN. Diese Vereinbarung beschreibt bestimmte
Rechte. Möglicherweise sehen die Gesetze Ihres Staats oder Lands andere Rechte vor, einschließlich
Verbraucherrechte. Möglicherweise verfügen Sie unabhängig von Ihrer Geschäftsbeziehung mit
Microsoft außerdem über Rechte im Hinblick auf den Lizenzgeber, von dem Sie die Software
erworben haben. Dieser Vertrag ändert diese anderen Rechte nicht, wenn die Gesetze Ihres
Bundesstaates oder Lands dies nicht gestatten. Wenn Sie die Software beispielsweise in einer der
unten genannten Regionen erworben haben oder zwingendes Recht des Landes Anwendung findet,
gelten die folgenden Bestimmungen für Sie:
a) Australien. Für Sie gelten die gesetzlichen Garantien gemäß des Australian Consumer Law und
diese Vereinbarung hat in keiner Weise die Absicht, diese Rechte einzuschränken.
b) Kanada. Sofern Sie diese Software in Kanada erwarben, können Sie ggf. den Empfang von
Aktualisierungen durch die Deaktivierung der automatischen Aktualisierungsfunktion einstellen
lassen bzw. durch die Trennung Ihres Gerätes vom Internet (sofern Sie das Gerät erneut
verbinden, wird die Software weiterhin Aktualisierungen aus dem Internet abfragen und zu
installieren versuchen) oder durch die Deinstallation der Software. Hinweise zur Deaktivierung
der Aktualisierungsfunktion bei Ihrem spezifischen Gerät oder Ihrer spezifischen Software sind
ggf. im Besonderen auch der jeweiligen Produktdokumentation zu entnehmen.
c) Deutschland und Österreich.
(i) Gewährleistung. Die Software wird im Wesentlichen so funktionieren, wie in den sie
begleitenden Microsoft-Unterlagen beschrieben. Jedoch gewährt Microsoft keine vertragliche
Garantie in Bezug auf die Software.
(ii) Haftungsbeschränkung. Bei Vorsatz, grober Fahrlässigkeit und Ansprüchen nach dem
Produkthaftungsgesetz sowie bei Tod oder Körperverletzung haftet Microsoft nach den
gesetzlichen Bestimmungen.
Vorbehaltlich der vorstehenden Klausel (ii) haftet Microsoft bei leichter Fahrlässigkeit nur, wenn das
Unternehmen eine wesentliche Vertragspflicht verletzt, deren Erfüllung die ordnungsgemäße
Durchführung dieses Vertrages überhaupt erst ermöglicht, deren Verletzung die Erreichung des
Vertragszwecks gefährdet und auf deren Einhaltung eine Partei regelmäßig vertrauen darf (sog.
„Kardinalpflichten“). In anderen Fällen von leichter Fahrlässigkeit haftet Microsoft nicht.
11. AUSSCHLUSS VON GARANTIEN. DIE SOFTWARE WIRD „WIE BESEHEN“ LIZENZIERT. SIE
TRAGEN DAS MIT DER VERWENDUNG VERBUNDENE RISIKO. MICROSOFT GEWÄHRT
KEINE AUSDRÜCKLICHEN GEWÄHRLEISTUNGEN ODER GARANTIEN. IN DEM NACH
IHREM ÖRTLICH ANWENDBAREN RECHT ZULÄSSIGEN UMFANG SCHLIESST MICROSOFT
KONKLUDENTE GARANTIEN DER HANDELSÜBLICHKEIT, EIGNUNG FÜR EINEN
BESTIMMTEN ZWECK UND NICHTVERLETZUNG VON RECHTEN DRITTER AUS.
12. BESCHRÄNKUNG UND AUSSCHLUSS VON ABHILFEANSPRÜCHEN UND SCHADENERSATZ.
SIE KÖNNEN VON MICROSOFT UND DEREN LIEFERANTEN NUR EINEN ERSATZ FÜR
DIREKTE SCHÄDEN BIS ZU EINEM BETRAG VON 5,00 US-DOLLAR ERHALTEN. SIE
KÖNNEN KEINEN ERSATZ FÜR ANDERE SCHÄDEN ERHALTEN, EINSCHLIESSLICH
FOLGESCHÄDEN, SCHÄDEN AUS ENTGANGENEM GEWINN, SPEZIELLER, INDIREKTER
ODER ZUFÄLLIGER SCHÄDEN.
Diese Einschränkung gilt für (a) jeden Gegenstand im Zusammenhang mit der Software, Diensten,
Inhalten (einschließlich Code) auf Internetseiten von Drittanbietern oder Anwendungen von Dritten
und (b) Ansprüche aus Vertragsverletzungen, Verletzungen der Garantie oder der Gewährleistung,
verschuldensunabhängiger Haftung, Fahrlässigkeit oder anderen unerlaubten Handlungen im durch
das anwendbare Recht zugelassenen Umfang.
Sie hat auch dann Gültigkeit, wenn Microsoft von der Möglichkeit der Schäden gewusst hat oder hätte
wissen müssen. Obige Beschränkung und obiger Ausschluss gelten möglicherweise nicht für Sie, weil
Ihr Staat oder Land den Ausschluss oder die Beschränkung von zufälligen Schäden, Folgeschäden
oder sonstigen Schäden nicht gestattet.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,39 @@
using System;
using System.Text;
using System.Web;
using System.Web.Http.Description;
namespace $rootnamespace$.Areas.HelpPage
{
public static class ApiDescriptionExtensions
{
/// <summary>
/// Generates an URI-friendly ID for the <see cref="ApiDescription"/>. E.g. "Get-Values-id_name" instead of "GetValues/{id}?name={name}"
/// </summary>
/// <param name="description">The <see cref="ApiDescription"/>.</param>
/// <returns>The ID as a string.</returns>
public static string GetFriendlyId(this ApiDescription description)
{
string path = description.RelativePath;
string[] urlParts = path.Split('?');
string localPath = urlParts[0];
string queryKeyString = null;
if (urlParts.Length > 1)
{
string query = urlParts[1];
string[] queryKeys = HttpUtility.ParseQueryString(query).AllKeys;
queryKeyString = String.Join("_", queryKeys);
}
StringBuilder friendlyPath = new StringBuilder();
friendlyPath.AppendFormat("{0}-{1}",
description.HttpMethod.Method,
localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty));
if (queryKeyString != null)
{
friendlyPath.AppendFormat("_{0}", queryKeyString.Replace('.', '-'));
}
return friendlyPath.ToString();
}
}
}

View File

@@ -0,0 +1,113 @@
// Uncomment the following to provide samples for PageResult<T>. Must also add the Microsoft.AspNet.WebApi.OData
// package to your project.
////#define Handle_PageResultOfT
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net.Http.Headers;
using System.Reflection;
using System.Web;
using System.Web.Http;
#if Handle_PageResultOfT
using System.Web.Http.OData;
#endif
namespace $rootnamespace$.Areas.HelpPage
{
/// <summary>
/// Use this class to customize the Help Page.
/// For example you can set a custom <see cref="System.Web.Http.Description.IDocumentationProvider"/> to supply the documentation
/// or you can provide the samples for the requests/responses.
/// </summary>
public static class HelpPageConfig
{
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters",
MessageId = "$rootnamespace$.Areas.HelpPage.TextSample.#ctor(System.String)",
Justification = "End users may choose to merge this string with existing localized resources.")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly",
MessageId = "bsonspec",
Justification = "Part of a URI.")]
public static void Register(HttpConfiguration config)
{
//// Uncomment the following to use the documentation from XML documentation file.
//config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
//// Uncomment the following to use "sample string" as the sample for all actions that have string as the body parameter or return type.
//// Also, the string arrays will be used for IEnumerable<string>. The sample objects will be serialized into different media type
//// formats by the available formatters.
//config.SetSampleObjects(new Dictionary<Type, object>
//{
// {typeof(string), "sample string"},
// {typeof(IEnumerable<string>), new string[]{"sample 1", "sample 2"}}
//});
// Extend the following to provide factories for types not handled automatically (those lacking parameterless
// constructors) or for which you prefer to use non-default property values. Line below provides a fallback
// since automatic handling will fail and GeneratePageResult handles only a single type.
#if Handle_PageResultOfT
config.GetHelpPageSampleGenerator().SampleObjectFactories.Add(GeneratePageResult);
#endif
// Extend the following to use a preset object directly as the sample for all actions that support a media
// type, regardless of the body parameter or return type. The lines below avoid display of binary content.
// The BsonMediaTypeFormatter (if available) is not used to serialize the TextSample object.
config.SetSampleForMediaType(
new TextSample("Binary JSON content. See http://bsonspec.org for details."),
new MediaTypeHeaderValue("application/bson"));
//// Uncomment the following to use "[0]=foo&[1]=bar" directly as the sample for all actions that support form URL encoded format
//// and have IEnumerable<string> as the body parameter or return type.
//config.SetSampleForType("[0]=foo&[1]=bar", new MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(IEnumerable<string>));
//// Uncomment the following to use "1234" directly as the request sample for media type "text/plain" on the controller named "Values"
//// and action named "Put".
//config.SetSampleRequest("1234", new MediaTypeHeaderValue("text/plain"), "Values", "Put");
//// Uncomment the following to use the image on "../images/aspNetHome.png" directly as the response sample for media type "image/png"
//// on the controller named "Values" and action named "Get" with parameter "id".
//config.SetSampleResponse(new ImageSample("../images/aspNetHome.png"), new MediaTypeHeaderValue("image/png"), "Values", "Get", "id");
//// Uncomment the following to correct the sample request when the action expects an HttpRequestMessage with ObjectContent<string>.
//// The sample will be generated as if the controller named "Values" and action named "Get" were having string as the body parameter.
//config.SetActualRequestType(typeof(string), "Values", "Get");
//// Uncomment the following to correct the sample response when the action returns an HttpResponseMessage with ObjectContent<string>.
//// The sample will be generated as if the controller named "Values" and action named "Post" were returning a string.
//config.SetActualResponseType(typeof(string), "Values", "Post");
}
#if Handle_PageResultOfT
private static object GeneratePageResult(HelpPageSampleGenerator sampleGenerator, Type type)
{
if (type.IsGenericType)
{
Type openGenericType = type.GetGenericTypeDefinition();
if (openGenericType == typeof(PageResult<>))
{
// Get the T in PageResult<T>
Type[] typeParameters = type.GetGenericArguments();
Debug.Assert(typeParameters.Length == 1);
// Create an enumeration to pass as the first parameter to the PageResult<T> constuctor
Type itemsType = typeof(List<>).MakeGenericType(typeParameters);
object items = sampleGenerator.GetSampleObject(itemsType);
// Fill in the other information needed to invoke the PageResult<T> constuctor
Type[] parameterTypes = new Type[] { itemsType, typeof(Uri), typeof(long?), };
object[] parameters = new object[] { items, null, (long)ObjectGenerator.DefaultCollectionSize, };
// Call PageResult(IEnumerable<T> items, Uri nextPageLink, long? count) constructor
ConstructorInfo constructor = type.GetConstructor(parameterTypes);
return constructor.Invoke(parameters);
}
}
return null;
}
#endif
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Web.Http;
using System.Web.Mvc;
using $rootnamespace$.Areas.HelpPage.ModelDescriptions;
using $rootnamespace$.Areas.HelpPage.Models;
namespace $rootnamespace$.Areas.HelpPage.Controllers
{
/// <summary>
/// The controller that will handle requests for the help page.
/// </summary>
public class HelpController : Controller
{
private const string ErrorViewName = "Error";
public HelpController()
: this(GlobalConfiguration.Configuration)
{
}
public HelpController(HttpConfiguration config)
{
Configuration = config;
}
public HttpConfiguration Configuration { get; private set; }
public ActionResult Index()
{
ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider();
return View(Configuration.Services.GetApiExplorer().ApiDescriptions);
}
public ActionResult Api(string apiId)
{
if (!String.IsNullOrEmpty(apiId))
{
HelpPageApiModel apiModel = Configuration.GetHelpPageApiModel(apiId);
if (apiModel != null)
{
return View(apiModel);
}
}
return View(ErrorViewName);
}
public ActionResult ResourceModel(string modelName)
{
if (!String.IsNullOrEmpty(modelName))
{
ModelDescriptionGenerator modelDescriptionGenerator = Configuration.GetModelDescriptionGenerator();
ModelDescription modelDescription;
if (modelDescriptionGenerator.GeneratedModels.TryGetValue(modelName, out modelDescription))
{
return View(modelDescription);
}
}
return View(ErrorViewName);
}
}
}

View File

@@ -0,0 +1,134 @@
.help-page h1,
.help-page .h1,
.help-page h2,
.help-page .h2,
.help-page h3,
.help-page .h3,
#body.help-page,
.help-page-table th,
.help-page-table pre,
.help-page-table p {
font-family: "Segoe UI Light", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
}
.help-page pre.wrapped {
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
white-space: pre-wrap;
}
.help-page .warning-message-container {
margin-top: 20px;
padding: 0 10px;
color: #525252;
background: #EFDCA9;
border: 1px solid #CCCCCC;
}
.help-page-table {
width: 100%;
border-collapse: collapse;
text-align: left;
margin: 0px 0px 20px 0px;
border-top: 1px solid #D4D4D4;
}
.help-page-table th {
text-align: left;
font-weight: bold;
border-bottom: 1px solid #D4D4D4;
padding: 5px 6px 5px 6px;
}
.help-page-table td {
border-bottom: 1px solid #D4D4D4;
padding: 10px 8px 10px 8px;
vertical-align: top;
}
.help-page-table pre,
.help-page-table p {
margin: 0px;
padding: 0px;
font-family: inherit;
font-size: 100%;
}
.help-page-table tbody tr:hover td {
background-color: #F3F3F3;
}
.help-page a:hover {
background-color: transparent;
}
.help-page .sample-header {
border: 2px solid #D4D4D4;
background: #00497E;
color: #FFFFFF;
padding: 8px 15px;
border-bottom: none;
display: inline-block;
margin: 10px 0px 0px 0px;
}
.help-page .sample-content {
display: block;
border-width: 0;
padding: 15px 20px;
background: #FFFFFF;
border: 2px solid #D4D4D4;
margin: 0px 0px 10px 0px;
}
.help-page .api-name {
width: 40%;
}
.help-page .api-documentation {
width: 60%;
}
.help-page .parameter-name {
width: 20%;
}
.help-page .parameter-documentation {
width: 40%;
}
.help-page .parameter-type {
width: 20%;
}
.help-page .parameter-annotations {
width: 20%;
}
.help-page h1,
.help-page .h1 {
font-size: 36px;
line-height: normal;
}
.help-page h2,
.help-page .h2 {
font-size: 24px;
}
.help-page h3,
.help-page .h3 {
font-size: 20px;
}
#body.help-page {
font-size: 14px;
line-height: 143%;
color: #333;
}
.help-page a {
color: #0000EE;
text-decoration: none;
}

View File

@@ -0,0 +1,26 @@
using System.Web.Http;
using System.Web.Mvc;
namespace $rootnamespace$.Areas.HelpPage
{
public class HelpPageAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "HelpPage";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"HelpPage_Default",
"Help/{action}/{apiId}",
new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });
HelpPageConfig.Register(GlobalConfiguration.Configuration);
}
}
}

View File

@@ -0,0 +1,467 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Description;
using $rootnamespace$.Areas.HelpPage.ModelDescriptions;
using $rootnamespace$.Areas.HelpPage.Models;
namespace $rootnamespace$.Areas.HelpPage
{
public static class HelpPageConfigurationExtensions
{
private const string ApiModelPrefix = "MS_HelpPageApiModel_";
/// <summary>
/// Sets the documentation provider for help page.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="documentationProvider">The documentation provider.</param>
public static void SetDocumentationProvider(this HttpConfiguration config, IDocumentationProvider documentationProvider)
{
config.Services.Replace(typeof(IDocumentationProvider), documentationProvider);
}
/// <summary>
/// Sets the objects that will be used by the formatters to produce sample requests/responses.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sampleObjects">The sample objects.</param>
public static void SetSampleObjects(this HttpConfiguration config, IDictionary<Type, object> sampleObjects)
{
config.GetHelpPageSampleGenerator().SampleObjects = sampleObjects;
}
/// <summary>
/// Sets the sample request directly for the specified media type and action.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sample">The sample request.</param>
/// <param name="mediaType">The media type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
public static void SetSampleRequest(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Request, controllerName, actionName, new[] { "*" }), sample);
}
/// <summary>
/// Sets the sample request directly for the specified media type and action with parameters.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sample">The sample request.</param>
/// <param name="mediaType">The media type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public static void SetSampleRequest(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName, params string[] parameterNames)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Request, controllerName, actionName, parameterNames), sample);
}
/// <summary>
/// Sets the sample request directly for the specified media type of the action.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sample">The sample response.</param>
/// <param name="mediaType">The media type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
public static void SetSampleResponse(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Response, controllerName, actionName, new[] { "*" }), sample);
}
/// <summary>
/// Sets the sample response directly for the specified media type of the action with specific parameters.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sample">The sample response.</param>
/// <param name="mediaType">The media type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public static void SetSampleResponse(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName, params string[] parameterNames)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Response, controllerName, actionName, parameterNames), sample);
}
/// <summary>
/// Sets the sample directly for all actions with the specified media type.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sample">The sample.</param>
/// <param name="mediaType">The media type.</param>
public static void SetSampleForMediaType(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType), sample);
}
/// <summary>
/// Sets the sample directly for all actions with the specified type and media type.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sample">The sample.</param>
/// <param name="mediaType">The media type.</param>
/// <param name="type">The parameter type or return type of an action.</param>
public static void SetSampleForType(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, Type type)
{
config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, type), sample);
}
/// <summary>
/// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> passed to the <see cref="System.Net.Http.HttpRequestMessage"/> in an action.
/// The help page will use this information to produce more accurate request samples.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="type">The type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
public static void SetActualRequestType(this HttpConfiguration config, Type type, string controllerName, string actionName)
{
config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Request, controllerName, actionName, new[] { "*" }), type);
}
/// <summary>
/// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> passed to the <see cref="System.Net.Http.HttpRequestMessage"/> in an action.
/// The help page will use this information to produce more accurate request samples.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="type">The type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public static void SetActualRequestType(this HttpConfiguration config, Type type, string controllerName, string actionName, params string[] parameterNames)
{
config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Request, controllerName, actionName, parameterNames), type);
}
/// <summary>
/// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> returned as part of the <see cref="System.Net.Http.HttpRequestMessage"/> in an action.
/// The help page will use this information to produce more accurate response samples.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="type">The type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
public static void SetActualResponseType(this HttpConfiguration config, Type type, string controllerName, string actionName)
{
config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Response, controllerName, actionName, new[] { "*" }), type);
}
/// <summary>
/// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> returned as part of the <see cref="System.Net.Http.HttpRequestMessage"/> in an action.
/// The help page will use this information to produce more accurate response samples.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="type">The type.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public static void SetActualResponseType(this HttpConfiguration config, Type type, string controllerName, string actionName, params string[] parameterNames)
{
config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Response, controllerName, actionName, parameterNames), type);
}
/// <summary>
/// Gets the help page sample generator.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <returns>The help page sample generator.</returns>
public static HelpPageSampleGenerator GetHelpPageSampleGenerator(this HttpConfiguration config)
{
return (HelpPageSampleGenerator)config.Properties.GetOrAdd(
typeof(HelpPageSampleGenerator),
k => new HelpPageSampleGenerator());
}
/// <summary>
/// Sets the help page sample generator.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="sampleGenerator">The help page sample generator.</param>
public static void SetHelpPageSampleGenerator(this HttpConfiguration config, HelpPageSampleGenerator sampleGenerator)
{
config.Properties.AddOrUpdate(
typeof(HelpPageSampleGenerator),
k => sampleGenerator,
(k, o) => sampleGenerator);
}
/// <summary>
/// Gets the model description generator.
/// </summary>
/// <param name="config">The configuration.</param>
/// <returns>The <see cref="ModelDescriptionGenerator"/></returns>
public static ModelDescriptionGenerator GetModelDescriptionGenerator(this HttpConfiguration config)
{
return (ModelDescriptionGenerator)config.Properties.GetOrAdd(
typeof(ModelDescriptionGenerator),
k => InitializeModelDescriptionGenerator(config));
}
/// <summary>
/// Gets the model that represents an API displayed on the help page. The model is initialized on the first call and cached for subsequent calls.
/// </summary>
/// <param name="config">The <see cref="HttpConfiguration"/>.</param>
/// <param name="apiDescriptionId">The <see cref="ApiDescription"/> ID.</param>
/// <returns>
/// An <see cref="HelpPageApiModel"/>
/// </returns>
public static HelpPageApiModel GetHelpPageApiModel(this HttpConfiguration config, string apiDescriptionId)
{
object model;
string modelId = ApiModelPrefix + apiDescriptionId;
if (!config.Properties.TryGetValue(modelId, out model))
{
Collection<ApiDescription> apiDescriptions = config.Services.GetApiExplorer().ApiDescriptions;
ApiDescription apiDescription = apiDescriptions.FirstOrDefault(api => String.Equals(api.GetFriendlyId(), apiDescriptionId, StringComparison.OrdinalIgnoreCase));
if (apiDescription != null)
{
model = GenerateApiModel(apiDescription, config);
config.Properties.TryAdd(modelId, model);
}
}
return (HelpPageApiModel)model;
}
private static HelpPageApiModel GenerateApiModel(ApiDescription apiDescription, HttpConfiguration config)
{
HelpPageApiModel apiModel = new HelpPageApiModel()
{
ApiDescription = apiDescription,
};
ModelDescriptionGenerator modelGenerator = config.GetModelDescriptionGenerator();
HelpPageSampleGenerator sampleGenerator = config.GetHelpPageSampleGenerator();
GenerateUriParameters(apiModel, modelGenerator);
GenerateRequestModelDescription(apiModel, modelGenerator, sampleGenerator);
GenerateResourceDescription(apiModel, modelGenerator);
GenerateSamples(apiModel, sampleGenerator);
return apiModel;
}
private static void GenerateUriParameters(HelpPageApiModel apiModel, ModelDescriptionGenerator modelGenerator)
{
ApiDescription apiDescription = apiModel.ApiDescription;
foreach (ApiParameterDescription apiParameter in apiDescription.ParameterDescriptions)
{
if (apiParameter.Source == ApiParameterSource.FromUri)
{
HttpParameterDescriptor parameterDescriptor = apiParameter.ParameterDescriptor;
Type parameterType = null;
ModelDescription typeDescription = null;
ComplexTypeModelDescription complexTypeDescription = null;
if (parameterDescriptor != null)
{
parameterType = parameterDescriptor.ParameterType;
typeDescription = modelGenerator.GetOrCreateModelDescription(parameterType);
complexTypeDescription = typeDescription as ComplexTypeModelDescription;
}
// Example:
// [TypeConverter(typeof(PointConverter))]
// public class Point
// {
// public Point(int x, int y)
// {
// X = x;
// Y = y;
// }
// public int X { get; set; }
// public int Y { get; set; }
// }
// Class Point is bindable with a TypeConverter, so Point will be added to UriParameters collection.
//
// public class Point
// {
// public int X { get; set; }
// public int Y { get; set; }
// }
// Regular complex class Point will have properties X and Y added to UriParameters collection.
if (complexTypeDescription != null
&& !IsBindableWithTypeConverter(parameterType))
{
foreach (ParameterDescription uriParameter in complexTypeDescription.Properties)
{
apiModel.UriParameters.Add(uriParameter);
}
}
else if (parameterDescriptor != null)
{
ParameterDescription uriParameter =
AddParameterDescription(apiModel, apiParameter, typeDescription);
if (!parameterDescriptor.IsOptional)
{
uriParameter.Annotations.Add(new ParameterAnnotation() { Documentation = "Required" });
}
object defaultValue = parameterDescriptor.DefaultValue;
if (defaultValue != null)
{
uriParameter.Annotations.Add(new ParameterAnnotation() { Documentation = "Default value is " + Convert.ToString(defaultValue, CultureInfo.InvariantCulture) });
}
}
else
{
Debug.Assert(parameterDescriptor == null);
// If parameterDescriptor is null, this is an undeclared route parameter which only occurs
// when source is FromUri. Ignored in request model and among resource parameters but listed
// as a simple string here.
ModelDescription modelDescription = modelGenerator.GetOrCreateModelDescription(typeof(string));
AddParameterDescription(apiModel, apiParameter, modelDescription);
}
}
}
}
private static bool IsBindableWithTypeConverter(Type parameterType)
{
if (parameterType == null)
{
return false;
}
return TypeDescriptor.GetConverter(parameterType).CanConvertFrom(typeof(string));
}
private static ParameterDescription AddParameterDescription(HelpPageApiModel apiModel,
ApiParameterDescription apiParameter, ModelDescription typeDescription)
{
ParameterDescription parameterDescription = new ParameterDescription
{
Name = apiParameter.Name,
Documentation = apiParameter.Documentation,
TypeDescription = typeDescription,
};
apiModel.UriParameters.Add(parameterDescription);
return parameterDescription;
}
private static void GenerateRequestModelDescription(HelpPageApiModel apiModel, ModelDescriptionGenerator modelGenerator, HelpPageSampleGenerator sampleGenerator)
{
ApiDescription apiDescription = apiModel.ApiDescription;
foreach (ApiParameterDescription apiParameter in apiDescription.ParameterDescriptions)
{
if (apiParameter.Source == ApiParameterSource.FromBody)
{
Type parameterType = apiParameter.ParameterDescriptor.ParameterType;
apiModel.RequestModelDescription = modelGenerator.GetOrCreateModelDescription(parameterType);
apiModel.RequestDocumentation = apiParameter.Documentation;
}
else if (apiParameter.ParameterDescriptor != null &&
apiParameter.ParameterDescriptor.ParameterType == typeof(HttpRequestMessage))
{
Type parameterType = sampleGenerator.ResolveHttpRequestMessageType(apiDescription);
if (parameterType != null)
{
apiModel.RequestModelDescription = modelGenerator.GetOrCreateModelDescription(parameterType);
}
}
}
}
private static void GenerateResourceDescription(HelpPageApiModel apiModel, ModelDescriptionGenerator modelGenerator)
{
ResponseDescription response = apiModel.ApiDescription.ResponseDescription;
Type responseType = response.ResponseType ?? response.DeclaredType;
if (responseType != null && responseType != typeof(void))
{
apiModel.ResourceDescription = modelGenerator.GetOrCreateModelDescription(responseType);
}
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "The exception is recorded as ErrorMessages.")]
private static void GenerateSamples(HelpPageApiModel apiModel, HelpPageSampleGenerator sampleGenerator)
{
try
{
foreach (var item in sampleGenerator.GetSampleRequests(apiModel.ApiDescription))
{
apiModel.SampleRequests.Add(item.Key, item.Value);
LogInvalidSampleAsError(apiModel, item.Value);
}
foreach (var item in sampleGenerator.GetSampleResponses(apiModel.ApiDescription))
{
apiModel.SampleResponses.Add(item.Key, item.Value);
LogInvalidSampleAsError(apiModel, item.Value);
}
}
catch (Exception e)
{
apiModel.ErrorMessages.Add(String.Format(CultureInfo.CurrentCulture,
"An exception has occurred while generating the sample. Exception message: {0}",
HelpPageSampleGenerator.UnwrapException(e).Message));
}
}
private static bool TryGetResourceParameter(ApiDescription apiDescription, HttpConfiguration config, out ApiParameterDescription parameterDescription, out Type resourceType)
{
parameterDescription = apiDescription.ParameterDescriptions.FirstOrDefault(
p => p.Source == ApiParameterSource.FromBody ||
(p.ParameterDescriptor != null && p.ParameterDescriptor.ParameterType == typeof(HttpRequestMessage)));
if (parameterDescription == null)
{
resourceType = null;
return false;
}
resourceType = parameterDescription.ParameterDescriptor.ParameterType;
if (resourceType == typeof(HttpRequestMessage))
{
HelpPageSampleGenerator sampleGenerator = config.GetHelpPageSampleGenerator();
resourceType = sampleGenerator.ResolveHttpRequestMessageType(apiDescription);
}
if (resourceType == null)
{
parameterDescription = null;
return false;
}
return true;
}
private static ModelDescriptionGenerator InitializeModelDescriptionGenerator(HttpConfiguration config)
{
ModelDescriptionGenerator modelGenerator = new ModelDescriptionGenerator(config);
Collection<ApiDescription> apis = config.Services.GetApiExplorer().ApiDescriptions;
foreach (ApiDescription api in apis)
{
ApiParameterDescription parameterDescription;
Type parameterType;
if (TryGetResourceParameter(api, config, out parameterDescription, out parameterType))
{
modelGenerator.GetOrCreateModelDescription(parameterType);
}
}
return modelGenerator;
}
private static void LogInvalidSampleAsError(HelpPageApiModel apiModel, object sample)
{
InvalidSample invalidSample = sample as InvalidSample;
if (invalidSample != null)
{
apiModel.ErrorMessages.Add(invalidSample.ErrorMessage);
}
}
}
}

View File

@@ -0,0 +1,7 @@
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class CollectionModelDescription : ModelDescription
{
public ModelDescription ElementDescription { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System.Collections.ObjectModel;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class ComplexTypeModelDescription : ModelDescription
{
public ComplexTypeModelDescription()
{
Properties = new Collection<ParameterDescription>();
}
public Collection<ParameterDescription> Properties { get; private set; }
}
}

View File

@@ -0,0 +1,6 @@
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class DictionaryModelDescription : KeyValuePairModelDescription
{
}
}

View File

@@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class EnumTypeModelDescription : ModelDescription
{
public EnumTypeModelDescription()
{
Values = new Collection<EnumValueDescription>();
}
public Collection<EnumValueDescription> Values { get; private set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class EnumValueDescription
{
public string Documentation { get; set; }
public string Name { get; set; }
public string Value { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Reflection;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public interface IModelDocumentationProvider
{
string GetDocumentation(MemberInfo member);
string GetDocumentation(Type type);
}
}

View File

@@ -0,0 +1,9 @@
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class KeyValuePairModelDescription : ModelDescription
{
public ModelDescription KeyModelDescription { get; set; }
public ModelDescription ValueModelDescription { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
/// <summary>
/// Describes a type model.
/// </summary>
public abstract class ModelDescription
{
public string Documentation { get; set; }
public Type ModelType { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,451 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
using System.Web.Http;
using System.Web.Http.Description;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
/// <summary>
/// Generates model descriptions for given types.
/// </summary>
public class ModelDescriptionGenerator
{
// Modify this to support more data annotation attributes.
private readonly IDictionary<Type, Func<object, string>> AnnotationTextGenerator = new Dictionary<Type, Func<object, string>>
{
{ typeof(RequiredAttribute), a => "Required" },
{ typeof(RangeAttribute), a =>
{
RangeAttribute range = (RangeAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Range: inclusive between {0} and {1}", range.Minimum, range.Maximum);
}
},
{ typeof(MaxLengthAttribute), a =>
{
MaxLengthAttribute maxLength = (MaxLengthAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Max length: {0}", maxLength.Length);
}
},
{ typeof(MinLengthAttribute), a =>
{
MinLengthAttribute minLength = (MinLengthAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Min length: {0}", minLength.Length);
}
},
{ typeof(StringLengthAttribute), a =>
{
StringLengthAttribute strLength = (StringLengthAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "String length: inclusive between {0} and {1}", strLength.MinimumLength, strLength.MaximumLength);
}
},
{ typeof(DataTypeAttribute), a =>
{
DataTypeAttribute dataType = (DataTypeAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Data type: {0}", dataType.CustomDataType ?? dataType.DataType.ToString());
}
},
{ typeof(RegularExpressionAttribute), a =>
{
RegularExpressionAttribute regularExpression = (RegularExpressionAttribute)a;
return String.Format(CultureInfo.CurrentCulture, "Matching regular expression pattern: {0}", regularExpression.Pattern);
}
},
};
// Modify this to add more default documentations.
private readonly IDictionary<Type, string> DefaultTypeDocumentation = new Dictionary<Type, string>
{
{ typeof(Int16), "integer" },
{ typeof(Int32), "integer" },
{ typeof(Int64), "integer" },
{ typeof(UInt16), "unsigned integer" },
{ typeof(UInt32), "unsigned integer" },
{ typeof(UInt64), "unsigned integer" },
{ typeof(Byte), "byte" },
{ typeof(Char), "character" },
{ typeof(SByte), "signed byte" },
{ typeof(Uri), "URI" },
{ typeof(Single), "decimal number" },
{ typeof(Double), "decimal number" },
{ typeof(Decimal), "decimal number" },
{ typeof(String), "string" },
{ typeof(Guid), "globally unique identifier" },
{ typeof(TimeSpan), "time interval" },
{ typeof(DateTime), "date" },
{ typeof(DateTimeOffset), "date" },
{ typeof(Boolean), "boolean" },
};
private Lazy<IModelDocumentationProvider> _documentationProvider;
public ModelDescriptionGenerator(HttpConfiguration config)
{
if (config == null)
{
throw new ArgumentNullException("config");
}
_documentationProvider = new Lazy<IModelDocumentationProvider>(() => config.Services.GetDocumentationProvider() as IModelDocumentationProvider);
GeneratedModels = new Dictionary<string, ModelDescription>(StringComparer.OrdinalIgnoreCase);
}
public Dictionary<string, ModelDescription> GeneratedModels { get; private set; }
private IModelDocumentationProvider DocumentationProvider
{
get
{
return _documentationProvider.Value;
}
}
public ModelDescription GetOrCreateModelDescription(Type modelType)
{
if (modelType == null)
{
throw new ArgumentNullException("modelType");
}
Type underlyingType = Nullable.GetUnderlyingType(modelType);
if (underlyingType != null)
{
modelType = underlyingType;
}
ModelDescription modelDescription;
string modelName = ModelNameHelper.GetModelName(modelType);
if (GeneratedModels.TryGetValue(modelName, out modelDescription))
{
if (modelType != modelDescription.ModelType)
{
throw new InvalidOperationException(
String.Format(
CultureInfo.CurrentCulture,
"A model description could not be created. Duplicate model name '{0}' was found for types '{1}' and '{2}'. " +
"Use the [ModelName] attribute to change the model name for at least one of the types so that it has a unique name.",
modelName,
modelDescription.ModelType.FullName,
modelType.FullName));
}
return modelDescription;
}
if (DefaultTypeDocumentation.ContainsKey(modelType))
{
return GenerateSimpleTypeModelDescription(modelType);
}
if (modelType.IsEnum)
{
return GenerateEnumTypeModelDescription(modelType);
}
if (modelType.IsGenericType)
{
Type[] genericArguments = modelType.GetGenericArguments();
if (genericArguments.Length == 1)
{
Type enumerableType = typeof(IEnumerable<>).MakeGenericType(genericArguments);
if (enumerableType.IsAssignableFrom(modelType))
{
return GenerateCollectionModelDescription(modelType, genericArguments[0]);
}
}
if (genericArguments.Length == 2)
{
Type dictionaryType = typeof(IDictionary<,>).MakeGenericType(genericArguments);
if (dictionaryType.IsAssignableFrom(modelType))
{
return GenerateDictionaryModelDescription(modelType, genericArguments[0], genericArguments[1]);
}
Type keyValuePairType = typeof(KeyValuePair<,>).MakeGenericType(genericArguments);
if (keyValuePairType.IsAssignableFrom(modelType))
{
return GenerateKeyValuePairModelDescription(modelType, genericArguments[0], genericArguments[1]);
}
}
}
if (modelType.IsArray)
{
Type elementType = modelType.GetElementType();
return GenerateCollectionModelDescription(modelType, elementType);
}
if (modelType == typeof(NameValueCollection))
{
return GenerateDictionaryModelDescription(modelType, typeof(string), typeof(string));
}
if (typeof(IDictionary).IsAssignableFrom(modelType))
{
return GenerateDictionaryModelDescription(modelType, typeof(object), typeof(object));
}
if (typeof(IEnumerable).IsAssignableFrom(modelType))
{
return GenerateCollectionModelDescription(modelType, typeof(object));
}
return GenerateComplexTypeModelDescription(modelType);
}
// Change this to provide different name for the member.
private static string GetMemberName(MemberInfo member, bool hasDataContractAttribute)
{
JsonPropertyAttribute jsonProperty = member.GetCustomAttribute<JsonPropertyAttribute>();
if (jsonProperty != null && !String.IsNullOrEmpty(jsonProperty.PropertyName))
{
return jsonProperty.PropertyName;
}
if (hasDataContractAttribute)
{
DataMemberAttribute dataMember = member.GetCustomAttribute<DataMemberAttribute>();
if (dataMember != null && !String.IsNullOrEmpty(dataMember.Name))
{
return dataMember.Name;
}
}
return member.Name;
}
private static bool ShouldDisplayMember(MemberInfo member, bool hasDataContractAttribute)
{
JsonIgnoreAttribute jsonIgnore = member.GetCustomAttribute<JsonIgnoreAttribute>();
XmlIgnoreAttribute xmlIgnore = member.GetCustomAttribute<XmlIgnoreAttribute>();
IgnoreDataMemberAttribute ignoreDataMember = member.GetCustomAttribute<IgnoreDataMemberAttribute>();
NonSerializedAttribute nonSerialized = member.GetCustomAttribute<NonSerializedAttribute>();
ApiExplorerSettingsAttribute apiExplorerSetting = member.GetCustomAttribute<ApiExplorerSettingsAttribute>();
bool hasMemberAttribute = member.DeclaringType.IsEnum ?
member.GetCustomAttribute<EnumMemberAttribute>() != null :
member.GetCustomAttribute<DataMemberAttribute>() != null;
// Display member only if all the followings are true:
// no JsonIgnoreAttribute
// no XmlIgnoreAttribute
// no IgnoreDataMemberAttribute
// no NonSerializedAttribute
// no ApiExplorerSettingsAttribute with IgnoreApi set to true
// no DataContractAttribute without DataMemberAttribute or EnumMemberAttribute
return jsonIgnore == null &&
xmlIgnore == null &&
ignoreDataMember == null &&
nonSerialized == null &&
(apiExplorerSetting == null || !apiExplorerSetting.IgnoreApi) &&
(!hasDataContractAttribute || hasMemberAttribute);
}
private string CreateDefaultDocumentation(Type type)
{
string documentation;
if (DefaultTypeDocumentation.TryGetValue(type, out documentation))
{
return documentation;
}
if (DocumentationProvider != null)
{
documentation = DocumentationProvider.GetDocumentation(type);
}
return documentation;
}
private void GenerateAnnotations(MemberInfo property, ParameterDescription propertyModel)
{
List<ParameterAnnotation> annotations = new List<ParameterAnnotation>();
IEnumerable<Attribute> attributes = property.GetCustomAttributes();
foreach (Attribute attribute in attributes)
{
Func<object, string> textGenerator;
if (AnnotationTextGenerator.TryGetValue(attribute.GetType(), out textGenerator))
{
annotations.Add(
new ParameterAnnotation
{
AnnotationAttribute = attribute,
Documentation = textGenerator(attribute)
});
}
}
// Rearrange the annotations
annotations.Sort((x, y) =>
{
// Special-case RequiredAttribute so that it shows up on top
if (x.AnnotationAttribute is RequiredAttribute)
{
return -1;
}
if (y.AnnotationAttribute is RequiredAttribute)
{
return 1;
}
// Sort the rest based on alphabetic order of the documentation
return String.Compare(x.Documentation, y.Documentation, StringComparison.OrdinalIgnoreCase);
});
foreach (ParameterAnnotation annotation in annotations)
{
propertyModel.Annotations.Add(annotation);
}
}
private CollectionModelDescription GenerateCollectionModelDescription(Type modelType, Type elementType)
{
ModelDescription collectionModelDescription = GetOrCreateModelDescription(elementType);
if (collectionModelDescription != null)
{
return new CollectionModelDescription
{
Name = ModelNameHelper.GetModelName(modelType),
ModelType = modelType,
ElementDescription = collectionModelDescription
};
}
return null;
}
private ModelDescription GenerateComplexTypeModelDescription(Type modelType)
{
ComplexTypeModelDescription complexModelDescription = new ComplexTypeModelDescription
{
Name = ModelNameHelper.GetModelName(modelType),
ModelType = modelType,
Documentation = CreateDefaultDocumentation(modelType)
};
GeneratedModels.Add(complexModelDescription.Name, complexModelDescription);
bool hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null;
PropertyInfo[] properties = modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo property in properties)
{
if (ShouldDisplayMember(property, hasDataContractAttribute))
{
ParameterDescription propertyModel = new ParameterDescription
{
Name = GetMemberName(property, hasDataContractAttribute)
};
if (DocumentationProvider != null)
{
propertyModel.Documentation = DocumentationProvider.GetDocumentation(property);
}
GenerateAnnotations(property, propertyModel);
complexModelDescription.Properties.Add(propertyModel);
propertyModel.TypeDescription = GetOrCreateModelDescription(property.PropertyType);
}
}
FieldInfo[] fields = modelType.GetFields(BindingFlags.Public | BindingFlags.Instance);
foreach (FieldInfo field in fields)
{
if (ShouldDisplayMember(field, hasDataContractAttribute))
{
ParameterDescription propertyModel = new ParameterDescription
{
Name = GetMemberName(field, hasDataContractAttribute)
};
if (DocumentationProvider != null)
{
propertyModel.Documentation = DocumentationProvider.GetDocumentation(field);
}
complexModelDescription.Properties.Add(propertyModel);
propertyModel.TypeDescription = GetOrCreateModelDescription(field.FieldType);
}
}
return complexModelDescription;
}
private DictionaryModelDescription GenerateDictionaryModelDescription(Type modelType, Type keyType, Type valueType)
{
ModelDescription keyModelDescription = GetOrCreateModelDescription(keyType);
ModelDescription valueModelDescription = GetOrCreateModelDescription(valueType);
return new DictionaryModelDescription
{
Name = ModelNameHelper.GetModelName(modelType),
ModelType = modelType,
KeyModelDescription = keyModelDescription,
ValueModelDescription = valueModelDescription
};
}
private EnumTypeModelDescription GenerateEnumTypeModelDescription(Type modelType)
{
EnumTypeModelDescription enumDescription = new EnumTypeModelDescription
{
Name = ModelNameHelper.GetModelName(modelType),
ModelType = modelType,
Documentation = CreateDefaultDocumentation(modelType)
};
bool hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null;
foreach (FieldInfo field in modelType.GetFields(BindingFlags.Public | BindingFlags.Static))
{
if (ShouldDisplayMember(field, hasDataContractAttribute))
{
EnumValueDescription enumValue = new EnumValueDescription
{
Name = field.Name,
Value = field.GetRawConstantValue().ToString()
};
if (DocumentationProvider != null)
{
enumValue.Documentation = DocumentationProvider.GetDocumentation(field);
}
enumDescription.Values.Add(enumValue);
}
}
GeneratedModels.Add(enumDescription.Name, enumDescription);
return enumDescription;
}
private KeyValuePairModelDescription GenerateKeyValuePairModelDescription(Type modelType, Type keyType, Type valueType)
{
ModelDescription keyModelDescription = GetOrCreateModelDescription(keyType);
ModelDescription valueModelDescription = GetOrCreateModelDescription(valueType);
return new KeyValuePairModelDescription
{
Name = ModelNameHelper.GetModelName(modelType),
ModelType = modelType,
KeyModelDescription = keyModelDescription,
ValueModelDescription = valueModelDescription
};
}
private ModelDescription GenerateSimpleTypeModelDescription(Type modelType)
{
SimpleTypeModelDescription simpleModelDescription = new SimpleTypeModelDescription
{
Name = ModelNameHelper.GetModelName(modelType),
ModelType = modelType,
Documentation = CreateDefaultDocumentation(modelType)
};
GeneratedModels.Add(simpleModelDescription.Name, simpleModelDescription);
return simpleModelDescription;
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
/// <summary>
/// Use this attribute to change the name of the <see cref="ModelDescription"/> generated for a type.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = false, Inherited = false)]
public sealed class ModelNameAttribute : Attribute
{
public ModelNameAttribute(string name)
{
Name = name;
}
public string Name { get; private set; }
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Globalization;
using System.Linq;
using System.Reflection;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
internal static class ModelNameHelper
{
// Modify this to provide custom model name mapping.
public static string GetModelName(Type type)
{
ModelNameAttribute modelNameAttribute = type.GetCustomAttribute<ModelNameAttribute>();
if (modelNameAttribute != null && !String.IsNullOrEmpty(modelNameAttribute.Name))
{
return modelNameAttribute.Name;
}
string modelName = type.Name;
if (type.IsGenericType)
{
// Format the generic type name to something like: GenericOfAgurment1AndArgument2
Type genericType = type.GetGenericTypeDefinition();
Type[] genericArguments = type.GetGenericArguments();
string genericTypeName = genericType.Name;
// Trim the generic parameter counts from the name
genericTypeName = genericTypeName.Substring(0, genericTypeName.IndexOf('`'));
string[] argumentTypeNames = genericArguments.Select(t => GetModelName(t)).ToArray();
modelName = String.Format(CultureInfo.InvariantCulture, "{0}Of{1}", genericTypeName, String.Join("And", argumentTypeNames));
}
return modelName;
}
}
}

View File

@@ -0,0 +1,11 @@
using System;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class ParameterAnnotation
{
public Attribute AnnotationAttribute { get; set; }
public string Documentation { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class ParameterDescription
{
public ParameterDescription()
{
Annotations = new Collection<ParameterAnnotation>();
}
public Collection<ParameterAnnotation> Annotations { get; private set; }
public string Documentation { get; set; }
public string Name { get; set; }
public ModelDescription TypeDescription { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
namespace $rootnamespace$.Areas.HelpPage.ModelDescriptions
{
public class SimpleTypeModelDescription : ModelDescription
{
}
}

View File

@@ -0,0 +1,108 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net.Http.Headers;
using System.Web.Http.Description;
using $rootnamespace$.Areas.HelpPage.ModelDescriptions;
namespace $rootnamespace$.Areas.HelpPage.Models
{
/// <summary>
/// The model that represents an API displayed on the help page.
/// </summary>
public class HelpPageApiModel
{
/// <summary>
/// Initializes a new instance of the <see cref="HelpPageApiModel"/> class.
/// </summary>
public HelpPageApiModel()
{
UriParameters = new Collection<ParameterDescription>();
SampleRequests = new Dictionary<MediaTypeHeaderValue, object>();
SampleResponses = new Dictionary<MediaTypeHeaderValue, object>();
ErrorMessages = new Collection<string>();
}
/// <summary>
/// Gets or sets the <see cref="ApiDescription"/> that describes the API.
/// </summary>
public ApiDescription ApiDescription { get; set; }
/// <summary>
/// Gets or sets the <see cref="ParameterDescription"/> collection that describes the URI parameters for the API.
/// </summary>
public Collection<ParameterDescription> UriParameters { get; private set; }
/// <summary>
/// Gets or sets the documentation for the request.
/// </summary>
public string RequestDocumentation { get; set; }
/// <summary>
/// Gets or sets the <see cref="ModelDescription"/> that describes the request body.
/// </summary>
public ModelDescription RequestModelDescription { get; set; }
/// <summary>
/// Gets the request body parameter descriptions.
/// </summary>
public IList<ParameterDescription> RequestBodyParameters
{
get
{
return GetParameterDescriptions(RequestModelDescription);
}
}
/// <summary>
/// Gets or sets the <see cref="ModelDescription"/> that describes the resource.
/// </summary>
public ModelDescription ResourceDescription { get; set; }
/// <summary>
/// Gets the resource property descriptions.
/// </summary>
public IList<ParameterDescription> ResourceProperties
{
get
{
return GetParameterDescriptions(ResourceDescription);
}
}
/// <summary>
/// Gets the sample requests associated with the API.
/// </summary>
public IDictionary<MediaTypeHeaderValue, object> SampleRequests { get; private set; }
/// <summary>
/// Gets the sample responses associated with the API.
/// </summary>
public IDictionary<MediaTypeHeaderValue, object> SampleResponses { get; private set; }
/// <summary>
/// Gets the error messages associated with this model.
/// </summary>
public Collection<string> ErrorMessages { get; private set; }
private static IList<ParameterDescription> GetParameterDescriptions(ModelDescription modelDescription)
{
ComplexTypeModelDescription complexTypeModelDescription = modelDescription as ComplexTypeModelDescription;
if (complexTypeModelDescription != null)
{
return complexTypeModelDescription.Properties;
}
CollectionModelDescription collectionModelDescription = modelDescription as CollectionModelDescription;
if (collectionModelDescription != null)
{
complexTypeModelDescription = collectionModelDescription.ElementDescription as ComplexTypeModelDescription;
if (complexTypeModelDescription != null)
{
return complexTypeModelDescription.Properties;
}
}
return null;
}
}
}

View File

@@ -0,0 +1,444 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Web.Http.Description;
using System.Xml.Linq;
using Newtonsoft.Json;
namespace $rootnamespace$.Areas.HelpPage
{
/// <summary>
/// This class will generate the samples for the help page.
/// </summary>
public class HelpPageSampleGenerator
{
/// <summary>
/// Initializes a new instance of the <see cref="HelpPageSampleGenerator"/> class.
/// </summary>
public HelpPageSampleGenerator()
{
ActualHttpMessageTypes = new Dictionary<HelpPageSampleKey, Type>();
ActionSamples = new Dictionary<HelpPageSampleKey, object>();
SampleObjects = new Dictionary<Type, object>();
SampleObjectFactories = new List<Func<HelpPageSampleGenerator, Type, object>>
{
DefaultSampleObjectFactory,
};
}
/// <summary>
/// Gets CLR types that are used as the content of <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/>.
/// </summary>
public IDictionary<HelpPageSampleKey, Type> ActualHttpMessageTypes { get; internal set; }
/// <summary>
/// Gets the objects that are used directly as samples for certain actions.
/// </summary>
public IDictionary<HelpPageSampleKey, object> ActionSamples { get; internal set; }
/// <summary>
/// Gets the objects that are serialized as samples by the supported formatters.
/// </summary>
public IDictionary<Type, object> SampleObjects { get; internal set; }
/// <summary>
/// Gets factories for the objects that the supported formatters will serialize as samples. Processed in order,
/// stopping when the factory successfully returns a non-<see langref="null"/> object.
/// </summary>
/// <remarks>
/// Collection includes just <see cref="ObjectGenerator.GenerateObject(Type)"/> initially. Use
/// <code>SampleObjectFactories.Insert(0, func)</code> to provide an override and
/// <code>SampleObjectFactories.Add(func)</code> to provide a fallback.</remarks>
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
Justification = "This is an appropriate nesting of generic types")]
public IList<Func<HelpPageSampleGenerator, Type, object>> SampleObjectFactories { get; private set; }
/// <summary>
/// Gets the request body samples for a given <see cref="ApiDescription"/>.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <returns>The samples keyed by media type.</returns>
public IDictionary<MediaTypeHeaderValue, object> GetSampleRequests(ApiDescription api)
{
return GetSample(api, SampleDirection.Request);
}
/// <summary>
/// Gets the response body samples for a given <see cref="ApiDescription"/>.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <returns>The samples keyed by media type.</returns>
public IDictionary<MediaTypeHeaderValue, object> GetSampleResponses(ApiDescription api)
{
return GetSample(api, SampleDirection.Response);
}
/// <summary>
/// Gets the request or response body samples.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <param name="sampleDirection">The value indicating whether the sample is for a request or for a response.</param>
/// <returns>The samples keyed by media type.</returns>
public virtual IDictionary<MediaTypeHeaderValue, object> GetSample(ApiDescription api, SampleDirection sampleDirection)
{
if (api == null)
{
throw new ArgumentNullException("api");
}
string controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
string actionName = api.ActionDescriptor.ActionName;
IEnumerable<string> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
Collection<MediaTypeFormatter> formatters;
Type type = ResolveType(api, controllerName, actionName, parameterNames, sampleDirection, out formatters);
var samples = new Dictionary<MediaTypeHeaderValue, object>();
// Use the samples provided directly for actions
var actionSamples = GetAllActionSamples(controllerName, actionName, parameterNames, sampleDirection);
foreach (var actionSample in actionSamples)
{
samples.Add(actionSample.Key.MediaType, WrapSampleIfString(actionSample.Value));
}
// Do the sample generation based on formatters only if an action doesn't return an HttpResponseMessage.
// Here we cannot rely on formatters because we don't know what's in the HttpResponseMessage, it might not even use formatters.
if (type != null && !typeof(HttpResponseMessage).IsAssignableFrom(type))
{
object sampleObject = GetSampleObject(type);
foreach (var formatter in formatters)
{
foreach (MediaTypeHeaderValue mediaType in formatter.SupportedMediaTypes)
{
if (!samples.ContainsKey(mediaType))
{
object sample = GetActionSample(controllerName, actionName, parameterNames, type, formatter, mediaType, sampleDirection);
// If no sample found, try generate sample using formatter and sample object
if (sample == null && sampleObject != null)
{
sample = WriteSampleObjectUsingFormatter(formatter, sampleObject, type, mediaType);
}
samples.Add(mediaType, WrapSampleIfString(sample));
}
}
}
}
return samples;
}
/// <summary>
/// Search for samples that are provided directly through <see cref="ActionSamples"/>.
/// </summary>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
/// <param name="type">The CLR type.</param>
/// <param name="formatter">The formatter.</param>
/// <param name="mediaType">The media type.</param>
/// <param name="sampleDirection">The value indicating whether the sample is for a request or for a response.</param>
/// <returns>The sample that matches the parameters.</returns>
public virtual object GetActionSample(string controllerName, string actionName, IEnumerable<string> parameterNames, Type type, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, SampleDirection sampleDirection)
{
object sample;
// First, try to get the sample provided for the specified mediaType, sampleDirection, controllerName, actionName and parameterNames.
// If not found, try to get the sample provided for the specified mediaType, sampleDirection, controllerName and actionName regardless of the parameterNames.
// If still not found, try to get the sample provided for the specified mediaType and type.
// Finally, try to get the sample provided for the specified mediaType.
if (ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, parameterNames), out sample) ||
ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, new[] { "*" }), out sample) ||
ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, type), out sample) ||
ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType), out sample))
{
return sample;
}
return null;
}
/// <summary>
/// Gets the sample object that will be serialized by the formatters.
/// First, it will look at the <see cref="SampleObjects"/>. If no sample object is found, it will try to create
/// one using <see cref="DefaultSampleObjectFactory"/> (which wraps an <see cref="ObjectGenerator"/>) and other
/// factories in <see cref="SampleObjectFactories"/>.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>The sample object.</returns>
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "Even if all items in SampleObjectFactories throw, problem will be visible as missing sample.")]
public virtual object GetSampleObject(Type type)
{
object sampleObject;
if (!SampleObjects.TryGetValue(type, out sampleObject))
{
// No specific object available, try our factories.
foreach (Func<HelpPageSampleGenerator, Type, object> factory in SampleObjectFactories)
{
if (factory == null)
{
continue;
}
try
{
sampleObject = factory(this, type);
if (sampleObject != null)
{
break;
}
}
catch
{
// Ignore any problems encountered in the factory; go on to the next one (if any).
}
}
}
return sampleObject;
}
/// <summary>
/// Resolves the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> passed to the <see cref="System.Net.Http.HttpRequestMessage"/> in an action.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <returns>The type.</returns>
public virtual Type ResolveHttpRequestMessageType(ApiDescription api)
{
string controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
string actionName = api.ActionDescriptor.ActionName;
IEnumerable<string> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
Collection<MediaTypeFormatter> formatters;
return ResolveType(api, controllerName, actionName, parameterNames, SampleDirection.Request, out formatters);
}
/// <summary>
/// Resolves the type of the action parameter or return value when <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/> is used.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
/// <param name="sampleDirection">The value indicating whether the sample is for a request or a response.</param>
/// <param name="formatters">The formatters.</param>
[SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", Justification = "This is only used in advanced scenarios.")]
public virtual Type ResolveType(ApiDescription api, string controllerName, string actionName, IEnumerable<string> parameterNames, SampleDirection sampleDirection, out Collection<MediaTypeFormatter> formatters)
{
if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection))
{
throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection));
}
if (api == null)
{
throw new ArgumentNullException("api");
}
Type type;
if (ActualHttpMessageTypes.TryGetValue(new HelpPageSampleKey(sampleDirection, controllerName, actionName, parameterNames), out type) ||
ActualHttpMessageTypes.TryGetValue(new HelpPageSampleKey(sampleDirection, controllerName, actionName, new[] { "*" }), out type))
{
// Re-compute the supported formatters based on type
Collection<MediaTypeFormatter> newFormatters = new Collection<MediaTypeFormatter>();
foreach (var formatter in api.ActionDescriptor.Configuration.Formatters)
{
if (IsFormatSupported(sampleDirection, formatter, type))
{
newFormatters.Add(formatter);
}
}
formatters = newFormatters;
}
else
{
switch (sampleDirection)
{
case SampleDirection.Request:
ApiParameterDescription requestBodyParameter = api.ParameterDescriptions.FirstOrDefault(p => p.Source == ApiParameterSource.FromBody);
type = requestBodyParameter == null ? null : requestBodyParameter.ParameterDescriptor.ParameterType;
formatters = api.SupportedRequestBodyFormatters;
break;
case SampleDirection.Response:
default:
type = api.ResponseDescription.ResponseType ?? api.ResponseDescription.DeclaredType;
formatters = api.SupportedResponseFormatters;
break;
}
}
return type;
}
/// <summary>
/// Writes the sample object using formatter.
/// </summary>
/// <param name="formatter">The formatter.</param>
/// <param name="value">The value.</param>
/// <param name="type">The type.</param>
/// <param name="mediaType">Type of the media.</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "The exception is recorded as InvalidSample.")]
public virtual object WriteSampleObjectUsingFormatter(MediaTypeFormatter formatter, object value, Type type, MediaTypeHeaderValue mediaType)
{
if (formatter == null)
{
throw new ArgumentNullException("formatter");
}
if (mediaType == null)
{
throw new ArgumentNullException("mediaType");
}
object sample = String.Empty;
MemoryStream ms = null;
HttpContent content = null;
try
{
if (formatter.CanWriteType(type))
{
ms = new MemoryStream();
content = new ObjectContent(type, value, formatter, mediaType);
formatter.WriteToStreamAsync(type, value, ms, content, null).Wait();
ms.Position = 0;
StreamReader reader = new StreamReader(ms);
string serializedSampleString = reader.ReadToEnd();
if (mediaType.MediaType.ToUpperInvariant().Contains("XML"))
{
serializedSampleString = TryFormatXml(serializedSampleString);
}
else if (mediaType.MediaType.ToUpperInvariant().Contains("JSON"))
{
serializedSampleString = TryFormatJson(serializedSampleString);
}
sample = new TextSample(serializedSampleString);
}
else
{
sample = new InvalidSample(String.Format(
CultureInfo.CurrentCulture,
"Failed to generate the sample for media type '{0}'. Cannot use formatter '{1}' to write type '{2}'.",
mediaType,
formatter.GetType().Name,
type.Name));
}
}
catch (Exception e)
{
sample = new InvalidSample(String.Format(
CultureInfo.CurrentCulture,
"An exception has occurred while using the formatter '{0}' to generate sample for media type '{1}'. Exception message: {2}",
formatter.GetType().Name,
mediaType.MediaType,
UnwrapException(e).Message));
}
finally
{
if (ms != null)
{
ms.Dispose();
}
if (content != null)
{
content.Dispose();
}
}
return sample;
}
internal static Exception UnwrapException(Exception exception)
{
AggregateException aggregateException = exception as AggregateException;
if (aggregateException != null)
{
return aggregateException.Flatten().InnerException;
}
return exception;
}
// Default factory for sample objects
private static object DefaultSampleObjectFactory(HelpPageSampleGenerator sampleGenerator, Type type)
{
// Try to create a default sample object
ObjectGenerator objectGenerator = new ObjectGenerator();
return objectGenerator.GenerateObject(type);
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")]
private static string TryFormatJson(string str)
{
try
{
object parsedJson = JsonConvert.DeserializeObject(str);
return JsonConvert.SerializeObject(parsedJson, Formatting.Indented);
}
catch
{
// can't parse JSON, return the original string
return str;
}
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")]
private static string TryFormatXml(string str)
{
try
{
XDocument xml = XDocument.Parse(str);
return xml.ToString();
}
catch
{
// can't parse XML, return the original string
return str;
}
}
private static bool IsFormatSupported(SampleDirection sampleDirection, MediaTypeFormatter formatter, Type type)
{
switch (sampleDirection)
{
case SampleDirection.Request:
return formatter.CanReadType(type);
case SampleDirection.Response:
return formatter.CanWriteType(type);
}
return false;
}
private IEnumerable<KeyValuePair<HelpPageSampleKey, object>> GetAllActionSamples(string controllerName, string actionName, IEnumerable<string> parameterNames, SampleDirection sampleDirection)
{
HashSet<string> parameterNamesSet = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase);
foreach (var sample in ActionSamples)
{
HelpPageSampleKey sampleKey = sample.Key;
if (String.Equals(controllerName, sampleKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
String.Equals(actionName, sampleKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
(sampleKey.ParameterNames.SetEquals(new[] { "*" }) || parameterNamesSet.SetEquals(sampleKey.ParameterNames)) &&
sampleDirection == sampleKey.SampleDirection)
{
yield return sample;
}
}
}
private static object WrapSampleIfString(object sample)
{
string stringSample = sample as string;
if (stringSample != null)
{
return new TextSample(stringSample);
}
return sample;
}
}
}

View File

@@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net.Http.Headers;
namespace $rootnamespace$.Areas.HelpPage
{
/// <summary>
/// This is used to identify the place where the sample should be applied.
/// </summary>
public class HelpPageSampleKey
{
/// <summary>
/// Creates a new <see cref="HelpPageSampleKey"/> based on media type.
/// </summary>
/// <param name="mediaType">The media type.</param>
public HelpPageSampleKey(MediaTypeHeaderValue mediaType)
{
if (mediaType == null)
{
throw new ArgumentNullException("mediaType");
}
ActionName = String.Empty;
ControllerName = String.Empty;
MediaType = mediaType;
ParameterNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
}
/// <summary>
/// Creates a new <see cref="HelpPageSampleKey"/> based on media type and CLR type.
/// </summary>
/// <param name="mediaType">The media type.</param>
/// <param name="type">The CLR type.</param>
public HelpPageSampleKey(MediaTypeHeaderValue mediaType, Type type)
: this(mediaType)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
ParameterType = type;
}
/// <summary>
/// Creates a new <see cref="HelpPageSampleKey"/> based on <see cref="SampleDirection"/>, controller name, action name and parameter names.
/// </summary>
/// <param name="sampleDirection">The <see cref="SampleDirection"/>.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public HelpPageSampleKey(SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable<string> parameterNames)
{
if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection))
{
throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection));
}
if (controllerName == null)
{
throw new ArgumentNullException("controllerName");
}
if (actionName == null)
{
throw new ArgumentNullException("actionName");
}
if (parameterNames == null)
{
throw new ArgumentNullException("parameterNames");
}
ControllerName = controllerName;
ActionName = actionName;
ParameterNames = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase);
SampleDirection = sampleDirection;
}
/// <summary>
/// Creates a new <see cref="HelpPageSampleKey"/> based on media type, <see cref="SampleDirection"/>, controller name, action name and parameter names.
/// </summary>
/// <param name="mediaType">The media type.</param>
/// <param name="sampleDirection">The <see cref="SampleDirection"/>.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
public HelpPageSampleKey(MediaTypeHeaderValue mediaType, SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable<string> parameterNames)
: this(sampleDirection, controllerName, actionName, parameterNames)
{
if (mediaType == null)
{
throw new ArgumentNullException("mediaType");
}
MediaType = mediaType;
}
/// <summary>
/// Gets the name of the controller.
/// </summary>
/// <value>
/// The name of the controller.
/// </value>
public string ControllerName { get; private set; }
/// <summary>
/// Gets the name of the action.
/// </summary>
/// <value>
/// The name of the action.
/// </value>
public string ActionName { get; private set; }
/// <summary>
/// Gets the media type.
/// </summary>
/// <value>
/// The media type.
/// </value>
public MediaTypeHeaderValue MediaType { get; private set; }
/// <summary>
/// Gets the parameter names.
/// </summary>
public HashSet<string> ParameterNames { get; private set; }
public Type ParameterType { get; private set; }
/// <summary>
/// Gets the <see cref="SampleDirection"/>.
/// </summary>
public SampleDirection? SampleDirection { get; private set; }
public override bool Equals(object obj)
{
HelpPageSampleKey otherKey = obj as HelpPageSampleKey;
if (otherKey == null)
{
return false;
}
return String.Equals(ControllerName, otherKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
String.Equals(ActionName, otherKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
(MediaType == otherKey.MediaType || (MediaType != null && MediaType.Equals(otherKey.MediaType))) &&
ParameterType == otherKey.ParameterType &&
SampleDirection == otherKey.SampleDirection &&
ParameterNames.SetEquals(otherKey.ParameterNames);
}
public override int GetHashCode()
{
int hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode();
if (MediaType != null)
{
hashCode ^= MediaType.GetHashCode();
}
if (SampleDirection != null)
{
hashCode ^= SampleDirection.GetHashCode();
}
if (ParameterType != null)
{
hashCode ^= ParameterType.GetHashCode();
}
foreach (string parameterName in ParameterNames)
{
hashCode ^= parameterName.ToUpperInvariant().GetHashCode();
}
return hashCode;
}
}
}

View File

@@ -0,0 +1,41 @@
using System;
namespace $rootnamespace$.Areas.HelpPage
{
/// <summary>
/// This represents an image sample on the help page. There's a display template named ImageSample associated with this class.
/// </summary>
public class ImageSample
{
/// <summary>
/// Initializes a new instance of the <see cref="ImageSample"/> class.
/// </summary>
/// <param name="src">The URL of an image.</param>
public ImageSample(string src)
{
if (src == null)
{
throw new ArgumentNullException("src");
}
Src = src;
}
public string Src { get; private set; }
public override bool Equals(object obj)
{
ImageSample other = obj as ImageSample;
return other != null && Src == other.Src;
}
public override int GetHashCode()
{
return Src.GetHashCode();
}
public override string ToString()
{
return Src;
}
}
}

View File

@@ -0,0 +1,37 @@
using System;
namespace $rootnamespace$.Areas.HelpPage
{
/// <summary>
/// This represents an invalid sample on the help page. There's a display template named InvalidSample associated with this class.
/// </summary>
public class InvalidSample
{
public InvalidSample(string errorMessage)
{
if (errorMessage == null)
{
throw new ArgumentNullException("errorMessage");
}
ErrorMessage = errorMessage;
}
public string ErrorMessage { get; private set; }
public override bool Equals(object obj)
{
InvalidSample other = obj as InvalidSample;
return other != null && ErrorMessage == other.ErrorMessage;
}
public override int GetHashCode()
{
return ErrorMessage.GetHashCode();
}
public override string ToString()
{
return ErrorMessage;
}
}
}

View File

@@ -0,0 +1,456 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Reflection;
namespace $rootnamespace$.Areas.HelpPage
{
/// <summary>
/// This class will create an object of a given type and populate it with sample data.
/// </summary>
public class ObjectGenerator
{
internal const int DefaultCollectionSize = 2;
private readonly SimpleTypeObjectGenerator SimpleObjectGenerator = new SimpleTypeObjectGenerator();
/// <summary>
/// Generates an object for a given type. The type needs to be public, have a public default constructor and settable public properties/fields. Currently it supports the following types:
/// Simple types: <see cref="int"/>, <see cref="string"/>, <see cref="Enum"/>, <see cref="DateTime"/>, <see cref="Uri"/>, etc.
/// Complex types: POCO types.
/// Nullables: <see cref="Nullable{T}"/>.
/// Arrays: arrays of simple types or complex types.
/// Key value pairs: <see cref="KeyValuePair{TKey,TValue}"/>
/// Tuples: <see cref="Tuple{T1}"/>, <see cref="Tuple{T1,T2}"/>, etc
/// Dictionaries: <see cref="IDictionary{TKey,TValue}"/> or anything deriving from <see cref="IDictionary{TKey,TValue}"/>.
/// Collections: <see cref="IList{T}"/>, <see cref="IEnumerable{T}"/>, <see cref="ICollection{T}"/>, <see cref="IList"/>, <see cref="IEnumerable"/>, <see cref="ICollection"/> or anything deriving from <see cref="ICollection{T}"/> or <see cref="IList"/>.
/// Queryables: <see cref="IQueryable"/>, <see cref="IQueryable{T}"/>.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>An object of the given type.</returns>
public object GenerateObject(Type type)
{
return GenerateObject(type, new Dictionary<Type, object>());
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Here we just want to return null if anything goes wrong.")]
private object GenerateObject(Type type, Dictionary<Type, object> createdObjectReferences)
{
try
{
if (SimpleTypeObjectGenerator.CanGenerateObject(type))
{
return SimpleObjectGenerator.GenerateObject(type);
}
if (type.IsArray)
{
return GenerateArray(type, DefaultCollectionSize, createdObjectReferences);
}
if (type.IsGenericType)
{
return GenerateGenericType(type, DefaultCollectionSize, createdObjectReferences);
}
if (type == typeof(IDictionary))
{
return GenerateDictionary(typeof(Hashtable), DefaultCollectionSize, createdObjectReferences);
}
if (typeof(IDictionary).IsAssignableFrom(type))
{
return GenerateDictionary(type, DefaultCollectionSize, createdObjectReferences);
}
if (type == typeof(IList) ||
type == typeof(IEnumerable) ||
type == typeof(ICollection))
{
return GenerateCollection(typeof(ArrayList), DefaultCollectionSize, createdObjectReferences);
}
if (typeof(IList).IsAssignableFrom(type))
{
return GenerateCollection(type, DefaultCollectionSize, createdObjectReferences);
}
if (type == typeof(IQueryable))
{
return GenerateQueryable(type, DefaultCollectionSize, createdObjectReferences);
}
if (type.IsEnum)
{
return GenerateEnum(type);
}
if (type.IsPublic || type.IsNestedPublic)
{
return GenerateComplexObject(type, createdObjectReferences);
}
}
catch
{
// Returns null if anything fails
return null;
}
return null;
}
private static object GenerateGenericType(Type type, int collectionSize, Dictionary<Type, object> createdObjectReferences)
{
Type genericTypeDefinition = type.GetGenericTypeDefinition();
if (genericTypeDefinition == typeof(Nullable<>))
{
return GenerateNullable(type, createdObjectReferences);
}
if (genericTypeDefinition == typeof(KeyValuePair<,>))
{
return GenerateKeyValuePair(type, createdObjectReferences);
}
if (IsTuple(genericTypeDefinition))
{
return GenerateTuple(type, createdObjectReferences);
}
Type[] genericArguments = type.GetGenericArguments();
if (genericArguments.Length == 1)
{
if (genericTypeDefinition == typeof(IList<>) ||
genericTypeDefinition == typeof(IEnumerable<>) ||
genericTypeDefinition == typeof(ICollection<>))
{
Type collectionType = typeof(List<>).MakeGenericType(genericArguments);
return GenerateCollection(collectionType, collectionSize, createdObjectReferences);
}
if (genericTypeDefinition == typeof(IQueryable<>))
{
return GenerateQueryable(type, collectionSize, createdObjectReferences);
}
Type closedCollectionType = typeof(ICollection<>).MakeGenericType(genericArguments[0]);
if (closedCollectionType.IsAssignableFrom(type))
{
return GenerateCollection(type, collectionSize, createdObjectReferences);
}
}
if (genericArguments.Length == 2)
{
if (genericTypeDefinition == typeof(IDictionary<,>))
{
Type dictionaryType = typeof(Dictionary<,>).MakeGenericType(genericArguments);
return GenerateDictionary(dictionaryType, collectionSize, createdObjectReferences);
}
Type closedDictionaryType = typeof(IDictionary<,>).MakeGenericType(genericArguments[0], genericArguments[1]);
if (closedDictionaryType.IsAssignableFrom(type))
{
return GenerateDictionary(type, collectionSize, createdObjectReferences);
}
}
if (type.IsPublic || type.IsNestedPublic)
{
return GenerateComplexObject(type, createdObjectReferences);
}
return null;
}
private static object GenerateTuple(Type type, Dictionary<Type, object> createdObjectReferences)
{
Type[] genericArgs = type.GetGenericArguments();
object[] parameterValues = new object[genericArgs.Length];
bool failedToCreateTuple = true;
ObjectGenerator objectGenerator = new ObjectGenerator();
for (int i = 0; i < genericArgs.Length; i++)
{
parameterValues[i] = objectGenerator.GenerateObject(genericArgs[i], createdObjectReferences);
failedToCreateTuple &= parameterValues[i] == null;
}
if (failedToCreateTuple)
{
return null;
}
object result = Activator.CreateInstance(type, parameterValues);
return result;
}
private static bool IsTuple(Type genericTypeDefinition)
{
return genericTypeDefinition == typeof(Tuple<>) ||
genericTypeDefinition == typeof(Tuple<,>) ||
genericTypeDefinition == typeof(Tuple<,,>) ||
genericTypeDefinition == typeof(Tuple<,,,>) ||
genericTypeDefinition == typeof(Tuple<,,,,>) ||
genericTypeDefinition == typeof(Tuple<,,,,,>) ||
genericTypeDefinition == typeof(Tuple<,,,,,,>) ||
genericTypeDefinition == typeof(Tuple<,,,,,,,>);
}
private static object GenerateKeyValuePair(Type keyValuePairType, Dictionary<Type, object> createdObjectReferences)
{
Type[] genericArgs = keyValuePairType.GetGenericArguments();
Type typeK = genericArgs[0];
Type typeV = genericArgs[1];
ObjectGenerator objectGenerator = new ObjectGenerator();
object keyObject = objectGenerator.GenerateObject(typeK, createdObjectReferences);
object valueObject = objectGenerator.GenerateObject(typeV, createdObjectReferences);
if (keyObject == null && valueObject == null)
{
// Failed to create key and values
return null;
}
object result = Activator.CreateInstance(keyValuePairType, keyObject, valueObject);
return result;
}
private static object GenerateArray(Type arrayType, int size, Dictionary<Type, object> createdObjectReferences)
{
Type type = arrayType.GetElementType();
Array result = Array.CreateInstance(type, size);
bool areAllElementsNull = true;
ObjectGenerator objectGenerator = new ObjectGenerator();
for (int i = 0; i < size; i++)
{
object element = objectGenerator.GenerateObject(type, createdObjectReferences);
result.SetValue(element, i);
areAllElementsNull &= element == null;
}
if (areAllElementsNull)
{
return null;
}
return result;
}
private static object GenerateDictionary(Type dictionaryType, int size, Dictionary<Type, object> createdObjectReferences)
{
Type typeK = typeof(object);
Type typeV = typeof(object);
if (dictionaryType.IsGenericType)
{
Type[] genericArgs = dictionaryType.GetGenericArguments();
typeK = genericArgs[0];
typeV = genericArgs[1];
}
object result = Activator.CreateInstance(dictionaryType);
MethodInfo addMethod = dictionaryType.GetMethod("Add") ?? dictionaryType.GetMethod("TryAdd");
MethodInfo containsMethod = dictionaryType.GetMethod("Contains") ?? dictionaryType.GetMethod("ContainsKey");
ObjectGenerator objectGenerator = new ObjectGenerator();
for (int i = 0; i < size; i++)
{
object newKey = objectGenerator.GenerateObject(typeK, createdObjectReferences);
if (newKey == null)
{
// Cannot generate a valid key
return null;
}
bool containsKey = (bool)containsMethod.Invoke(result, new object[] { newKey });
if (!containsKey)
{
object newValue = objectGenerator.GenerateObject(typeV, createdObjectReferences);
addMethod.Invoke(result, new object[] { newKey, newValue });
}
}
return result;
}
private static object GenerateEnum(Type enumType)
{
Array possibleValues = Enum.GetValues(enumType);
if (possibleValues.Length > 0)
{
return possibleValues.GetValue(0);
}
return null;
}
private static object GenerateQueryable(Type queryableType, int size, Dictionary<Type, object> createdObjectReferences)
{
bool isGeneric = queryableType.IsGenericType;
object list;
if (isGeneric)
{
Type listType = typeof(List<>).MakeGenericType(queryableType.GetGenericArguments());
list = GenerateCollection(listType, size, createdObjectReferences);
}
else
{
list = GenerateArray(typeof(object[]), size, createdObjectReferences);
}
if (list == null)
{
return null;
}
if (isGeneric)
{
Type argumentType = typeof(IEnumerable<>).MakeGenericType(queryableType.GetGenericArguments());
MethodInfo asQueryableMethod = typeof(Queryable).GetMethod("AsQueryable", new[] { argumentType });
return asQueryableMethod.Invoke(null, new[] { list });
}
return Queryable.AsQueryable((IEnumerable)list);
}
private static object GenerateCollection(Type collectionType, int size, Dictionary<Type, object> createdObjectReferences)
{
Type type = collectionType.IsGenericType ?
collectionType.GetGenericArguments()[0] :
typeof(object);
object result = Activator.CreateInstance(collectionType);
MethodInfo addMethod = collectionType.GetMethod("Add");
bool areAllElementsNull = true;
ObjectGenerator objectGenerator = new ObjectGenerator();
for (int i = 0; i < size; i++)
{
object element = objectGenerator.GenerateObject(type, createdObjectReferences);
addMethod.Invoke(result, new object[] { element });
areAllElementsNull &= element == null;
}
if (areAllElementsNull)
{
return null;
}
return result;
}
private static object GenerateNullable(Type nullableType, Dictionary<Type, object> createdObjectReferences)
{
Type type = nullableType.GetGenericArguments()[0];
ObjectGenerator objectGenerator = new ObjectGenerator();
return objectGenerator.GenerateObject(type, createdObjectReferences);
}
private static object GenerateComplexObject(Type type, Dictionary<Type, object> createdObjectReferences)
{
object result = null;
if (createdObjectReferences.TryGetValue(type, out result))
{
// The object has been created already, just return it. This will handle the circular reference case.
return result;
}
if (type.IsValueType)
{
result = Activator.CreateInstance(type);
}
else
{
ConstructorInfo defaultCtor = type.GetConstructor(Type.EmptyTypes);
if (defaultCtor == null)
{
// Cannot instantiate the type because it doesn't have a default constructor
return null;
}
result = defaultCtor.Invoke(new object[0]);
}
createdObjectReferences.Add(type, result);
SetPublicProperties(type, result, createdObjectReferences);
SetPublicFields(type, result, createdObjectReferences);
return result;
}
private static void SetPublicProperties(Type type, object obj, Dictionary<Type, object> createdObjectReferences)
{
PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
ObjectGenerator objectGenerator = new ObjectGenerator();
foreach (PropertyInfo property in properties)
{
if (property.CanWrite)
{
object propertyValue = objectGenerator.GenerateObject(property.PropertyType, createdObjectReferences);
property.SetValue(obj, propertyValue, null);
}
}
}
private static void SetPublicFields(Type type, object obj, Dictionary<Type, object> createdObjectReferences)
{
FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
ObjectGenerator objectGenerator = new ObjectGenerator();
foreach (FieldInfo field in fields)
{
object fieldValue = objectGenerator.GenerateObject(field.FieldType, createdObjectReferences);
field.SetValue(obj, fieldValue);
}
}
private class SimpleTypeObjectGenerator
{
private long _index = 0;
private static readonly Dictionary<Type, Func<long, object>> DefaultGenerators = InitializeGenerators();
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "These are simple type factories and cannot be split up.")]
private static Dictionary<Type, Func<long, object>> InitializeGenerators()
{
return new Dictionary<Type, Func<long, object>>
{
{ typeof(Boolean), index => true },
{ typeof(Byte), index => (Byte)64 },
{ typeof(Char), index => (Char)65 },
{ typeof(DateTime), index => DateTime.Now },
{ typeof(DateTimeOffset), index => new DateTimeOffset(DateTime.Now) },
{ typeof(DBNull), index => DBNull.Value },
{ typeof(Decimal), index => (Decimal)index },
{ typeof(Double), index => (Double)(index + 0.1) },
{ typeof(Guid), index => Guid.NewGuid() },
{ typeof(Int16), index => (Int16)(index % Int16.MaxValue) },
{ typeof(Int32), index => (Int32)(index % Int32.MaxValue) },
{ typeof(Int64), index => (Int64)index },
{ typeof(Object), index => new object() },
{ typeof(SByte), index => (SByte)64 },
{ typeof(Single), index => (Single)(index + 0.1) },
{
typeof(String), index =>
{
return String.Format(CultureInfo.CurrentCulture, "sample string {0}", index);
}
},
{
typeof(TimeSpan), index =>
{
return TimeSpan.FromTicks(1234567);
}
},
{ typeof(UInt16), index => (UInt16)(index % UInt16.MaxValue) },
{ typeof(UInt32), index => (UInt32)(index % UInt32.MaxValue) },
{ typeof(UInt64), index => (UInt64)index },
{
typeof(Uri), index =>
{
return new Uri(String.Format(CultureInfo.CurrentCulture, "http://webapihelppage{0}.com", index));
}
},
};
}
public static bool CanGenerateObject(Type type)
{
return DefaultGenerators.ContainsKey(type);
}
public object GenerateObject(Type type)
{
return DefaultGenerators[type](++_index);
}
}
}
}

View File

@@ -0,0 +1,11 @@
namespace $rootnamespace$.Areas.HelpPage
{
/// <summary>
/// Indicates whether the sample is used for request or response
/// </summary>
public enum SampleDirection
{
Request = 0,
Response
}
}

View File

@@ -0,0 +1,37 @@
using System;
namespace $rootnamespace$.Areas.HelpPage
{
/// <summary>
/// This represents a preformatted text sample on the help page. There's a display template named TextSample associated with this class.
/// </summary>
public class TextSample
{
public TextSample(string text)
{
if (text == null)
{
throw new ArgumentNullException("text");
}
Text = text;
}
public string Text { get; private set; }
public override bool Equals(object obj)
{
TextSample other = obj as TextSample;
return other != null && Text == other.Text;
}
public override int GetHashCode()
{
return Text.GetHashCode();
}
public override string ToString()
{
return Text;
}
}
}

View File

@@ -0,0 +1,22 @@
@using System.Web.Http
@using $rootnamespace$.Areas.HelpPage.Models
@model HelpPageApiModel
@{
var description = Model.ApiDescription;
ViewBag.Title = description.HttpMethod.Method + " " + description.RelativePath;
}
<link type="text/css" href="~/Areas/HelpPage/HelpPage.css" rel="stylesheet" />
<div id="body" class="help-page">
<section class="featured">
<div class="content-wrapper">
<p>
@Html.ActionLink("Help Page Home", "Index")
</p>
</div>
</section>
<section class="content-wrapper main-content clear-fix">
@Html.DisplayForModel()
</section>
</div>

Some files were not shown because too many files have changed in this diff Show More