Browse Source

Updated Nuget Packages.

Optimized Blacklist module to not use locks.
tags/3.0.0
Teknikode 1 year ago
parent
commit
3b17dd9e76
62 changed files with 12836 additions and 1169 deletions
  1. 3
    6
      ServerMaint/ServerMaint.csproj
  2. 4
    4
      ServerMaint/app.config
  3. 2
    2
      ServerMaint/packages.config
  4. 5
    48
      Teknik/Modules/BlacklistModule.cs
  5. BIN
      Teknik/Scripts/_references.js
  6. 0
    4
      Teknik/Scripts/jquery-3.1.1.min.js
  7. 0
    1
      Teknik/Scripts/jquery-3.1.1.min.map
  8. 0
    4
      Teknik/Scripts/jquery-3.1.1.slim.min.js
  9. 0
    1
      Teknik/Scripts/jquery-3.1.1.slim.min.map
  10. 2670
    0
      Teknik/Scripts/jquery-3.3.1.intellisense.js
  11. 601
    457
      Teknik/Scripts/jquery-3.3.1.js
  12. 2
    0
      Teknik/Scripts/jquery-3.3.1.min.js
  13. 1
    0
      Teknik/Scripts/jquery-3.3.1.min.map
  14. 564
    402
      Teknik/Scripts/jquery-3.3.1.slim.js
  15. 2
    0
      Teknik/Scripts/jquery-3.3.1.slim.min.js
  16. 1
    0
      Teknik/Scripts/jquery-3.3.1.slim.min.map
  17. 0
    9
      Teknik/Scripts/jquery.signalR-2.2.1.min.js
  18. 7
    4
      Teknik/Scripts/jquery.signalR-2.2.2.js
  19. 9
    0
      Teknik/Scripts/jquery.signalR-2.2.2.min.js
  20. 2
    2
      Teknik/Scripts/jquery.validate-vsdoc.js
  21. 89
    62
      Teknik/Scripts/jquery.validate.js
  22. 4
    4
      Teknik/Scripts/jquery.validate.min.js
  23. 49
    42
      Teknik/Teknik.csproj
  24. 13
    13
      Teknik/Web.config
  25. 934
    0
      Teknik/docs/MySqlCommand.xml
  26. 321
    0
      Teknik/docs/MySqlCommandBuilder.xml
  27. 1248
    0
      Teknik/docs/MySqlConnection.xml
  28. 55
    0
      Teknik/docs/MySqlConnectionStringBuilder.xml
  29. 801
    0
      Teknik/docs/MySqlDataAdapter.xml
  30. 452
    0
      Teknik/docs/MySqlDataReader.xml
  31. 53
    0
      Teknik/docs/MySqlException.xml
  32. 53
    0
      Teknik/docs/MySqlHelper.xml
  33. 45
    0
      Teknik/docs/MySqlParameter.xml
  34. 45
    0
      Teknik/docs/MySqlParameterCollection.xml
  35. 329
    0
      Teknik/docs/MySqlTransaction.xml
  36. 15
    15
      Teknik/packages.config
  37. 4
    4
      TeknikStreaming/App.config
  38. 2
    4
      TeknikStreaming/TeknikStreaming.csproj
  39. 1
    1
      TeknikStreaming/packages.config
  40. 21
    13
      TeknikTests/TeknikTests.csproj
  41. 9
    8
      TeknikTests/packages.config
  42. 1
    2
      Utilities/Configuration/Configuration.csproj
  43. 1
    1
      Utilities/Configuration/packages.config
  44. 2
    3
      Utilities/Piwik/Piwik.csproj
  45. 22
    23
      Utilities/Piwik/Tracking.cs
  46. 1
    1
      Utilities/Piwik/packages.config
  47. 24
    5
      Utilities/Utilities/Utilities.csproj
  48. 1
    1
      Utilities/Utilities/app.config
  49. 934
    0
      Utilities/Utilities/docs/MySqlCommand.xml
  50. 321
    0
      Utilities/Utilities/docs/MySqlCommandBuilder.xml
  51. 1248
    0
      Utilities/Utilities/docs/MySqlConnection.xml
  52. 55
    0
      Utilities/Utilities/docs/MySqlConnectionStringBuilder.xml
  53. 801
    0
      Utilities/Utilities/docs/MySqlDataAdapter.xml
  54. 452
    0
      Utilities/Utilities/docs/MySqlDataReader.xml
  55. 53
    0
      Utilities/Utilities/docs/MySqlException.xml
  56. 53
    0
      Utilities/Utilities/docs/MySqlHelper.xml
  57. 45
    0
      Utilities/Utilities/docs/MySqlParameter.xml
  58. 45
    0
      Utilities/Utilities/docs/MySqlParameterCollection.xml
  59. 329
    0
      Utilities/Utilities/docs/MySqlTransaction.xml
  60. 2
    2
      Utilities/Utilities/packages.config
  61. 21
    13
      UtilitiesTests/UtilitiesTests.csproj
  62. 9
    8
      UtilitiesTests/packages.config

+ 3
- 6
ServerMaint/ServerMaint.csproj View File

@@ -57,12 +57,10 @@
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
@@ -77,8 +75,7 @@
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />

+ 4
- 4
ServerMaint/app.config View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<connectionStrings configSource="ConnectionStrings.config" />
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
@@ -30,11 +30,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

+ 2
- 2
ServerMaint/packages.config View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommandLineParser" version="1.9.71" targetFramework="net452" />
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
<package id="EntityFramework" version="6.2.0" targetFramework="net462" />
<package id="GitVersionTask" version="3.6.5" targetFramework="net462" developmentDependency="true" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
<package id="nClam" version="2.0.6.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="10.0.1" targetFramework="net462" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" />
</packages>

+ 5
- 48
Teknik/Modules/BlacklistModule.cs View File

@@ -33,56 +33,11 @@ namespace Teknik.Modules
context.BeginRequest += onBeginRequest;
}

#region Referrer Info
private const string BLOCKEDREFERRERKEY = "BlockedReferrer";
private static string referrerFileName = null;
private static object referrerFileNameObj = new object();

public static string GetReferrerFilePath()
{
if (referrerFileName != null)
return referrerFileName;
lock (referrerFileNameObj)
{
if (referrerFileName == null)
{
Config config = Config.Load();
referrerFileName = config.ReferrerBlacklistFile;
}
}

return referrerFileName;
}
#endregion

#region IP Info
private const string BLOCKEDIPKEY = "BlockedIP";
private static string ipFileName = null;
private static object ipFileNameObj = new object();

public static string GetIPFilePath()
{
if (ipFileName != null)
return ipFileName;
lock (ipFileNameObj)
{
if (ipFileName == null)
{
Config config = Config.Load();
ipFileName = config.IPBlacklistFile;
}
}

return ipFileName;
}
#endregion

public static StringDictionary GetFileData(HttpContext context, string key, Func<string> fn)
public static StringDictionary GetFileData(HttpContext context, string key, string filePath)
{
StringDictionary data = (StringDictionary)context.Cache[key];
if (data == null)
{
string filePath = fn();
data = GetFileLines(filePath);
context.Cache.Insert(key, data, new CacheDependency(filePath));
}
@@ -118,6 +73,8 @@ namespace Teknik.Modules

if (app != null)
{
Config config = Config.Load();

bool blocked = false;
string blockReason = string.Empty;

@@ -127,7 +84,7 @@ namespace Teknik.Modules
string IPAddr = app.Context.Request.ServerVariables["REMOTE_ADDR"];
if (!string.IsNullOrEmpty(IPAddr))
{
StringDictionary badIPs = GetFileData(app.Context, BLOCKEDIPKEY, GetIPFilePath);
StringDictionary badIPs = GetFileData(app.Context, "BlockedIPs", config.IPBlacklistFile);

blocked |= (badIPs != null && badIPs.ContainsKey(IPAddr));
blockReason = $"This IP address ({IPAddr}) has been blacklisted. If you feel this is in error, please contact support@teknik.io for assistance.";
@@ -141,7 +98,7 @@ namespace Teknik.Modules
string referrer = app.Context.Request.UrlReferrer?.Host;
if (!string.IsNullOrEmpty(referrer))
{
StringDictionary badReferrers = GetFileData(app.Context, BLOCKEDREFERRERKEY, GetReferrerFilePath);
StringDictionary badReferrers = GetFileData(app.Context, "BlockedReferrers", config.ReferrerBlacklistFile);

blocked |= (badReferrers != null && badReferrers.ContainsKey(referrer));
blockReason = $"This referrer ({referrer}) has been blacklisted. If you feel this is in error, please contact support@teknik.io for assistance.";

BIN
Teknik/Scripts/_references.js View File


+ 0
- 4
Teknik/Scripts/jquery-3.1.1.min.js
File diff suppressed because it is too large
View File


+ 0
- 1
Teknik/Scripts/jquery-3.1.1.min.map
File diff suppressed because it is too large
View File


+ 0
- 4
Teknik/Scripts/jquery-3.1.1.slim.min.js
File diff suppressed because it is too large
View File


+ 0
- 1
Teknik/Scripts/jquery-3.1.1.slim.min.map
File diff suppressed because it is too large
View File


+ 2670
- 0
Teknik/Scripts/jquery-3.3.1.intellisense.js
File diff suppressed because it is too large
View File


Teknik/Scripts/jquery-3.3.1.js
File diff suppressed because it is too large
View File


+ 2
- 0
Teknik/Scripts/jquery-3.3.1.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
Teknik/Scripts/jquery-3.3.1.min.map
File diff suppressed because it is too large
View File


Teknik/Scripts/jquery-3.3.1.slim.js
File diff suppressed because it is too large
View File


+ 2
- 0
Teknik/Scripts/jquery-3.3.1.slim.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
Teknik/Scripts/jquery-3.3.1.slim.min.map
File diff suppressed because it is too large
View File


+ 0
- 9
Teknik/Scripts/jquery.signalR-2.2.1.min.js
File diff suppressed because it is too large
View File


Teknik/Scripts/jquery.signalR-2.2.1.js → Teknik/Scripts/jquery.signalR-2.2.2.js View File

@@ -1,7 +1,7 @@
/* jquery.signalR.core.js */
/*global window:false */
/*!
* ASP.NET SignalR JavaScript Library v2.2.1
* ASP.NET SignalR JavaScript Library v2.2.2
* http://signalr.net/
*
* Copyright (c) .NET Foundation. All rights reserved.
@@ -950,6 +950,9 @@

// Clear out our message buffer
connection._.connectingMessageBuffer.clear();
// Clean up this event
$(connection).unbind(events.onStart);

// Trigger the disconnect event
changeState(connection, connection.state, signalR.connectionState.disconnected);
@@ -2227,8 +2230,8 @@
}

// Ensure the iframe is where we left it
if (connection.frame.parentNode === window.document.body) {
window.document.body.removeChild(connection.frame);
if (connection.frame.parentNode === window.document.documentElement) {
window.document.documentElement.removeChild(connection.frame);
}

delete transportLogic.foreverFrame.connections[connection.frameId];
@@ -2951,5 +2954,5 @@
/*global window:false */
/// <reference path="jquery.signalR.core.js" />
(function ($, undefined) {
$.signalR.version = "2.2.1";
$.signalR.version = "2.2.2";
}(window.jQuery));

+ 9
- 0
Teknik/Scripts/jquery.signalR-2.2.2.min.js
File diff suppressed because it is too large
View File


+ 2
- 2
Teknik/Scripts/jquery.validate-vsdoc.js View File

@@ -4,7 +4,7 @@
* intended to be used only for design-time IntelliSense. Please use the
* standard jQuery library for all production use.
*
* Comment version: 1.16.0
* Comment version: 1.17.0
*/

/*
@@ -15,7 +15,7 @@
* for informational purposes only and are not the license terms under
* which Microsoft distributed this file.
*
* jQuery Validation Plugin - v1.16.0 - 12/5/2016
* jQuery Validation Plugin - v1.17.0 - 12/5/2016
* https://github.com/jzaefferer/jquery-validation
* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT
*

+ 89
- 62
Teknik/Scripts/jquery.validate.js View File

@@ -1,9 +1,9 @@
/*!
* jQuery Validation Plugin v1.16.0
* jQuery Validation Plugin v1.17.0
*
* http://jqueryvalidation.org/
* https://jqueryvalidation.org/
*
* Copyright (c) 2016 Jörn Zaefferer
* Copyright (c) 2017 Jörn Zaefferer
* Released under the MIT license
*/
(function( factory ) {
@@ -18,7 +18,7 @@

$.extend( $.fn, {

// http://jqueryvalidation.org/validate/
// https://jqueryvalidation.org/validate/
validate: function( options ) {

// If nothing is selected, return nothing; can't chain anyway
@@ -44,9 +44,10 @@ $.extend( $.fn, {
if ( validator.settings.onsubmit ) {

this.on( "click.validate", ":submit", function( event ) {
if ( validator.settings.submitHandler ) {
validator.submitButton = event.target;
}

// Track the used submit button to properly handle scripted
// submits later.
validator.submitButton = event.currentTarget;

// Allow suppressing validation by adding a cancel class to the submit button
if ( $( this ).hasClass( "cancel" ) ) {
@@ -68,17 +69,22 @@ $.extend( $.fn, {
}
function handle() {
var hidden, result;
if ( validator.settings.submitHandler ) {
if ( validator.submitButton ) {

// Insert a hidden input as a replacement for the missing submit button
hidden = $( "<input type='hidden'/>" )
.attr( "name", validator.submitButton.name )
.val( $( validator.submitButton ).val() )
.appendTo( validator.currentForm );
}
// Insert a hidden input as a replacement for the missing submit button
// The hidden input is inserted in two cases:
// - A user defined a `submitHandler`
// - There was a pending request due to `remote` method and `stopRequest()`
// was called to submit the form in case it's valid
if ( validator.submitButton && ( validator.settings.submitHandler || validator.formSubmitted ) ) {
hidden = $( "<input type='hidden'/>" )
.attr( "name", validator.submitButton.name )
.val( $( validator.submitButton ).val() )
.appendTo( validator.currentForm );
}

if ( validator.settings.submitHandler ) {
result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
if ( validator.submitButton ) {
if ( hidden ) {

// And clean up afterwards; thanks to no-block-scope, hidden can be referenced
hidden.remove();
@@ -112,7 +118,7 @@ $.extend( $.fn, {
return validator;
},

// http://jqueryvalidation.org/valid/
// https://jqueryvalidation.org/valid/
valid: function() {
var valid, validator, errorList;

@@ -133,13 +139,22 @@ $.extend( $.fn, {
return valid;
},

// http://jqueryvalidation.org/rules/
// https://jqueryvalidation.org/rules/
rules: function( command, argument ) {
var element = this[ 0 ],
settings, staticRules, existingRules, data, param, filtered;

// If nothing is selected, return empty object; can't chain anyway
if ( element == null || element.form == null ) {
if ( element == null ) {
return;
}

if ( !element.form && element.hasAttribute( "contenteditable" ) ) {
element.form = this.closest( "form" )[ 0 ];
element.name = this.attr( "name" );
}

if ( element.form == null ) {
return;
}

@@ -167,9 +182,6 @@ $.extend( $.fn, {
$.each( argument.split( /\s/ ), function( index, method ) {
filtered[ method ] = existingRules[ method ];
delete existingRules[ method ];
if ( method === "required" ) {
$( element ).removeAttr( "aria-required" );
}
} );
return filtered;
}
@@ -189,7 +201,6 @@ $.extend( $.fn, {
param = data.required;
delete data.required;
data = $.extend( { required: param }, data );
$( element ).attr( "aria-required", "true" );
}

// Make sure remote is at back
@@ -206,18 +217,18 @@ $.extend( $.fn, {
// Custom selectors
$.extend( $.expr.pseudos || $.expr[ ":" ], { // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support

// http://jqueryvalidation.org/blank-selector/
// https://jqueryvalidation.org/blank-selector/
blank: function( a ) {
return !$.trim( "" + $( a ).val() );
},

// http://jqueryvalidation.org/filled-selector/
// https://jqueryvalidation.org/filled-selector/
filled: function( a ) {
var val = $( a ).val();
return val !== null && !!$.trim( "" + val );
},

// http://jqueryvalidation.org/unchecked-selector/
// https://jqueryvalidation.org/unchecked-selector/
unchecked: function( a ) {
return !$( a ).prop( "checked" );
}
@@ -230,7 +241,7 @@ $.validator = function( options, form ) {
this.init();
};

// http://jqueryvalidation.org/jQuery.validator.format/
// https://jqueryvalidation.org/jQuery.validator.format/
$.validator.format = function( source, params ) {
if ( arguments.length === 1 ) {
return function() {
@@ -343,7 +354,7 @@ $.extend( $.validator, {
}
},

// http://jqueryvalidation.org/jQuery.validator.setDefaults/
// https://jqueryvalidation.org/jQuery.validator.setDefaults/
setDefaults: function( settings ) {
$.extend( $.validator.defaults, settings );
},
@@ -402,6 +413,7 @@ $.extend( $.validator, {
// Set form expando on contenteditable
if ( !this.form && this.hasAttribute( "contenteditable" ) ) {
this.form = $( this ).closest( "form" )[ 0 ];
this.name = $( this ).attr( "name" );
}

var validator = $.data( this.form, "validator" ),
@@ -426,13 +438,9 @@ $.extend( $.validator, {
if ( this.settings.invalidHandler ) {
$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
}

// Add aria-required to any Static/Data/Class required fields before first validation
// Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html
$( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" );
},

// http://jqueryvalidation.org/Validator.form/
// https://jqueryvalidation.org/Validator.form/
form: function() {
this.checkForm();
$.extend( this.submitted, this.errorMap );
@@ -452,7 +460,7 @@ $.extend( $.validator, {
return this.valid();
},

// http://jqueryvalidation.org/Validator.element/
// https://jqueryvalidation.org/Validator.element/
element: function( element ) {
var cleanElement = this.clean( element ),
checkElement = this.validationTargetFor( cleanElement ),
@@ -503,7 +511,7 @@ $.extend( $.validator, {
return result;
},

// http://jqueryvalidation.org/Validator.showErrors/
// https://jqueryvalidation.org/Validator.showErrors/
showErrors: function( errors ) {
if ( errors ) {
var validator = this;
@@ -529,7 +537,7 @@ $.extend( $.validator, {
}
},

// http://jqueryvalidation.org/Validator.resetForm/
// https://jqueryvalidation.org/Validator.resetForm/
resetForm: function() {
if ( $.fn.resetForm ) {
$( this.currentForm ).resetForm();
@@ -570,7 +578,10 @@ $.extend( $.validator, {
var count = 0,
i;
for ( i in obj ) {
if ( obj[ i ] ) {

// This check allows counting elements with empty error
// message as invalid elements
if ( obj[ i ] !== undefined && obj[ i ] !== null && obj[ i ] !== false ) {
count++;
}
}
@@ -635,6 +646,7 @@ $.extend( $.validator, {
// Set form expando on contenteditable
if ( this.hasAttribute( "contenteditable" ) ) {
this.form = $( this ).closest( "form" )[ 0 ];
this.name = name;
}

// Select only the first element for each name, and only those with rules specified
@@ -735,21 +747,27 @@ $.extend( $.validator, {
} ).length,
dependencyMismatch = false,
val = this.elementValue( element ),
result, method, rule;
result, method, rule, normalizer;

// If a normalizer is defined for this element, then
// call it to retreive the changed value instead
// Prioritize the local normalizer defined for this element over the global one
// if the former exists, otherwise user the global one in case it exists.
if ( typeof rules.normalizer === "function" ) {
normalizer = rules.normalizer;
} else if ( typeof this.settings.normalizer === "function" ) {
normalizer = this.settings.normalizer;
}

// If normalizer is defined, then call it to retreive the changed value instead
// of using the real one.
// Note that `this` in the normalizer is `element`.
if ( typeof rules.normalizer === "function" ) {
val = rules.normalizer.call( element, val );
if ( normalizer ) {
val = normalizer.call( element, val );

if ( typeof val !== "string" ) {
throw new TypeError( "The normalizer should return a string value." );
}

// Delete the normalizer from rules to avoid treating
// it as a pre-defined method.
// Delete the normalizer from rules to avoid treating it as a pre-defined method.
delete rules.normalizer;
}

@@ -1089,6 +1107,15 @@ $.extend( $.validator, {
$( element ).removeClass( this.settings.pendingClass );
if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
$( this.currentForm ).submit();

// Remove the hidden input that was used as a replacement for the
// missing submit button. The hidden input is added by `handle()`
// to ensure that the value of the used submit button is passed on
// for scripted submits triggered by this method
if ( this.submitButton ) {
$( "input:hidden[name='" + this.submitButton.name + "']", this.currentForm ).remove();
}

this.formSubmitted = false;
} else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
@@ -1316,7 +1343,7 @@ $.extend( $.validator, {
return data;
},

// http://jqueryvalidation.org/jQuery.validator.addMethod/
// https://jqueryvalidation.org/jQuery.validator.addMethod/
addMethod: function( name, method, message ) {
$.validator.methods[ name ] = method;
$.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
@@ -1325,10 +1352,10 @@ $.extend( $.validator, {
}
},

// http://jqueryvalidation.org/jQuery.validator.methods/
// https://jqueryvalidation.org/jQuery.validator.methods/
methods: {

// http://jqueryvalidation.org/required-method/
// https://jqueryvalidation.org/required-method/
required: function( value, element, param ) {

// Check if dependency is met
@@ -1347,7 +1374,7 @@ $.extend( $.validator, {
return value.length > 0;
},

// http://jqueryvalidation.org/email-method/
// https://jqueryvalidation.org/email-method/
email: function( value, element ) {

// From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
@@ -1357,7 +1384,7 @@ $.extend( $.validator, {
return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
},

// http://jqueryvalidation.org/url-method/
// https://jqueryvalidation.org/url-method/
url: function( value, element ) {

// Copyright (c) 2010-2013 Diego Perini, MIT licensed
@@ -1367,60 +1394,60 @@ $.extend( $.validator, {
return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
},

// http://jqueryvalidation.org/date-method/
// https://jqueryvalidation.org/date-method/
date: function( value, element ) {
return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
},

// http://jqueryvalidation.org/dateISO-method/
// https://jqueryvalidation.org/dateISO-method/
dateISO: function( value, element ) {
return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
},

// http://jqueryvalidation.org/number-method/
// https://jqueryvalidation.org/number-method/
number: function( value, element ) {
return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
},

// http://jqueryvalidation.org/digits-method/
// https://jqueryvalidation.org/digits-method/
digits: function( value, element ) {
return this.optional( element ) || /^\d+$/.test( value );
},

// http://jqueryvalidation.org/minlength-method/
// https://jqueryvalidation.org/minlength-method/
minlength: function( value, element, param ) {
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || length >= param;
},

// http://jqueryvalidation.org/maxlength-method/
// https://jqueryvalidation.org/maxlength-method/
maxlength: function( value, element, param ) {
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || length <= param;
},

// http://jqueryvalidation.org/rangelength-method/
// https://jqueryvalidation.org/rangelength-method/
rangelength: function( value, element, param ) {
var length = $.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
},

// http://jqueryvalidation.org/min-method/
// https://jqueryvalidation.org/min-method/
min: function( value, element, param ) {
return this.optional( element ) || value >= param;
},

// http://jqueryvalidation.org/max-method/
// https://jqueryvalidation.org/max-method/
max: function( value, element, param ) {
return this.optional( element ) || value <= param;
},

// http://jqueryvalidation.org/range-method/
// https://jqueryvalidation.org/range-method/
range: function( value, element, param ) {
return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
},

// http://jqueryvalidation.org/step-method/
// https://jqueryvalidation.org/step-method/
step: function( value, element, param ) {
var type = $( element ).attr( "type" ),
errorMessage = "Step attribute on input type " + type + " is not supported.",
@@ -1458,7 +1485,7 @@ $.extend( $.validator, {
return this.optional( element ) || valid;
},

// http://jqueryvalidation.org/equalTo-method/
// https://jqueryvalidation.org/equalTo-method/
equalTo: function( value, element, param ) {

// Bind to the blur event of the target in order to revalidate whenever the target field is updated
@@ -1471,7 +1498,7 @@ $.extend( $.validator, {
return value === target.val();
},

// http://jqueryvalidation.org/remote-method/
// https://jqueryvalidation.org/remote-method/
remote: function( value, element, param, method ) {
if ( this.optional( element ) ) {
return "dependency-mismatch";

+ 4
- 4
Teknik/Scripts/jquery.validate.min.js
File diff suppressed because it is too large
View File


+ 49
- 42
Teknik/Teknik.csproj View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -53,12 +53,10 @@
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="IRCSharp, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\IRCSharp.1.0.0.1\lib\net462\IRCSharp.dll</HintPath>
@@ -76,41 +74,34 @@
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.2.2.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=2.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.2.2.2\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNet.SignalR.SystemWeb, Version=2.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.SignalR.SystemWeb.2.2.1\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.AspNet.SignalR.SystemWeb, Version=2.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.SignalR.SystemWeb.2.2.2\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.KeyVault.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Azure.KeyVault.Core.2.0.4\lib\net45\Microsoft.Azure.KeyVault.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.3.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.Owin.Host.SystemWeb, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Security, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.Owin.Security, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.Security.3.1.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
</Reference>
<Reference Include="Mime-Detective, Version=0.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Mime-Detective.0.0.5\lib\net45\Mime-Detective.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
<Private>True</Private>
<Reference Include="MySql.Data, Version=6.10.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.10.6\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="NBitcoin, Version=3.0.2.10, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NBitcoin.3.0.2.10\lib\net45\NBitcoin.dll</HintPath>
@@ -121,16 +112,14 @@
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Piwik.Tracker, Version=2.16.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Piwik.Tracker.2.16.0.0\lib\net40\Piwik.Tracker.dll</HintPath>
<Private>True</Private>
<Reference Include="Piwik.Tracker, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Piwik.Tracker.3.0.0\lib\net40\Piwik.Tracker.dll</HintPath>
</Reference>
<Reference Include="PresentationFramework" />
<Reference Include="QRCoder, Version=1.2.3.0, Culture=neutral, processorArchitecture=MSIL">
@@ -138,12 +127,18 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Management" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
@@ -523,6 +518,17 @@
<Content Include="Content\Highlight\xcode.css" />
<Content Include="Content\Highlight\zenburn.css" />
<Content Include="Content\jquery.tocify.css" />
<Content Include="docs\MySqlCommand.xml" />
<Content Include="docs\MySqlCommandBuilder.xml" />
<Content Include="docs\MySqlConnection.xml" />
<Content Include="docs\MySqlConnectionStringBuilder.xml" />
<Content Include="docs\MySqlDataAdapter.xml" />
<Content Include="docs\MySqlDataReader.xml" />
<Content Include="docs\MySqlException.xml" />
<Content Include="docs\MySqlHelper.xml" />
<Content Include="docs\MySqlParameter.xml" />
<Content Include="docs\MySqlParameterCollection.xml" />
<Content Include="docs\MySqlTransaction.xml" />
<Content Include="Fonts\fontawesome-webfont.svg" />
<Content Include="Fonts\glyphicons-halflings-regular.svg" />
<Content Include="Images\redbubble_icon.png" />
@@ -716,16 +722,17 @@
<Content Include="Scripts\Highcharts\highcharts.js" />
<Content Include="Scripts\Highlight\highlight.pack.js" />
<None Include="Scripts\jquery-3.1.1.intellisense.js" />
<Content Include="Scripts\jquery-3.1.1.js" />
<Content Include="Scripts\jquery-3.1.1.min.js" />
<Content Include="Scripts\jquery-3.1.1.slim.js" />
<Content Include="Scripts\jquery-3.1.1.slim.min.js" />
<None Include="Scripts\jquery-3.3.1.intellisense.js" />
<Content Include="Scripts\jquery-3.3.1.js" />
<Content Include="Scripts\jquery-3.3.1.min.js" />
<Content Include="Scripts\jquery-3.3.1.slim.js" />
<Content Include="Scripts\jquery-3.3.1.slim.min.js" />
<Content Include="Scripts\jquery-ui.widgets.js" />
<Content Include="Scripts\jquery.blockUI.js" />
<Content Include="Scripts\jquery.fileupload.js" />
<Content Include="Scripts\jquery.iframe-transport.js" />
<Content Include="Scripts\jquery.signalR-2.2.1.js" />
<Content Include="Scripts\jquery.signalR-2.2.1.min.js" />
<Content Include="Scripts\jquery.signalR-2.2.2.js" />
<Content Include="Scripts\jquery.signalR-2.2.2.min.js" />
<Content Include="Scripts\jquery.tocify.min.js" />
<None Include="Scripts\jquery.validate-vsdoc.js" />
<Content Include="Scripts\jquery.validate.js" />
@@ -769,8 +776,8 @@
<Content Include="Areas\User\Views\User\Register.cshtml" />
<Content Include="Areas\Dev\Views\Dev\Index.cshtml" />
<Content Include="Areas\User\Views\User\_LoginModalPartial.cshtml" />
<Content Include="Scripts\jquery-3.1.1.slim.min.map" />
<Content Include="Scripts\jquery-3.1.1.min.map" />
<Content Include="Scripts\jquery-3.3.1.slim.min.map" />
<Content Include="Scripts\jquery-3.3.1.min.map" />
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\About\Models\" />
@@ -899,8 +906,8 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\GitVersionTask.3.6.5\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.6.5\build\dotnet\GitVersionTask.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

+ 13
- 13
Teknik/Web.config View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
@@ -6,7 +6,7 @@
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<connectionStrings configSource="App_Data\ConnectionStrings.config" />
<!-- Create ConnectionStrings.config and add your connection string node-->
<!--
@@ -135,7 +135,7 @@
<add name="Access-Control-Allow-Headers" value="Authorization, Accept, Origin, Content-Type, X-Requested-With, Connection, Transfer-Encoding" />
<add name="strict-transport-security" value="max-age=31536000; includeSubdomains; preload" />
<add name="X-XSS-Protection" value="1; mode=block" />
<add name="Vary" value="Origin"/>
<add name="Vary" value="Origin" />
</customHeaders>
</httpProtocol>
<httpErrors errorMode="Detailed" />
@@ -172,11 +172,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -190,16 +190,16 @@
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
<add description=".Net Framework Data Provider for MySQL" invariant="MySql.Data.MySqlClient" name="MySQL Data Provider" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.10.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
</configuration>

+ 934
- 0
Teknik/docs/MySqlCommand.xml View File

@@ -0,0 +1,934 @@
<docs>
<ClassSummary>
<summary>Represents a SQL statement to execute against a MySQL database. This class cannot be inherited.</summary>
<remarks>
<B>MySqlCommand</B> features the following methods for executing commands at a MySQL database:
<list type="table">
<listheader>
<term>Item</term>
<term>Description</term>
</listheader>
<item>
<term>
<a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteReader_overloads.html">ExecuteReader</a>
</term>
<description>Executes commands that return rows.</description>
</item>
<item>
<term>
<a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery.html">ExecuteNonQuery</a>
</term>
<description>Executes commands such as SQL INSERT, DELETE, and UPDATE statements.</description>
</item>
<item>
<term>
<a href="MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar.html">ExecuteScalar</a>
</term>
<description>Retrieves a single value (for example, an aggregate value) from a database.</description>
</item>
</list>

You can reset the <B>CommandText</B> property and reuse the <B>MySqlCommand</B>
object. However, you must close the <A
href="MySql.Data.MySqlClient.MySqlDataReader.html">MySqlDataReader</A>
before you can execute a new or previous command.

If a <A href="MySql.Data.MySqlClient.MySqlException.html">MySqlException</A> is
generated by the method executing a <B>MySqlCommand</B>, the <A
href="MySql.Data.MySqlClient.MySqlConnection.html">MySqlConnection</A>
remains open. It is the responsibility of the programmer to close the connection.

<note>
Using the '@' symbol for paramters is now the preferred approach although the old pattern of using
'?' is still supported. Please be aware though that using '@' can cause conflicts when user variables
are also used. To help with this situation please see the documentation on the 'allow user variables'
connection string option. The 'old syntax' connection string option has now been deprecated.
</note>
</remarks>

<example>
The following example creates a <A href="frlrfsystemdatasqlclientsqlcommandclasstopic.htm">MySqlCommand</A> and
a <B>MySqlConnection</B>. The <B>MySqlConnection</B> is opened and set as the <A
href="frlrfsystemdatasqlclientsqlcommandclassconnectiontopic.htm">Connection</A>
for the <B>MySqlCommand</B>. The example then calls <A
href="frlrfsystemdatasqlclientsqlcommandclassexecutenonquerytopic.htm">ExecuteNonQuery</A>,
and closes the connection. To accomplish this, the <B>ExecuteNonQuery</B> is
passed a connection string and a query string that is a SQL INSERT
statement.
<code lang="vbnet">
Public Sub InsertRow(myConnectionString As String)
&quot; If the connection string is null, use a default.
If myConnectionString = "" Then
myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
End If
Dim myConnection As New MySqlConnection(myConnectionString)
Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
Dim myCommand As New MySqlCommand(myInsertQuery)
myCommand.Connection = myConnection
myConnection.Open()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()
End Sub
</code>
<code lang="C#">
public void InsertRow(string myConnectionString)
{
// If the connection string is null, use a default.
if(myConnectionString == "")
{
myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
}
MySqlConnection myConnection = new MySqlConnection(myConnectionString);
string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
}
</code>
</example>
</ClassSummary>



<ctor1>
<overloads>
<summary>
Initializes a new instance of the MySqlCommand class.
</summary>
<example>
The following example creates a MySqlCommand and sets some of its properties.
<para></para>
<note>
This example shows how to use one of the overloaded
versions of the MySqlCommand constructor. For other examples that might be available,
see the individual overload topics.
</note>

<code lang="vbnet">
Public Sub CreateMySqlCommand()
Dim myConnection As New MySqlConnection _
("Persist Security Info=False;database=test;server=myServer")
myConnection.Open()
Dim myTrans As MySqlTransaction = myConnection.BeginTransaction()
Dim mySelectQuery As String = "SELECT * FROM MyTable"
Dim myCommand As New MySqlCommand(mySelectQuery, myConnection, myTrans)
myCommand.CommandTimeout = 20
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand()
{
MySqlConnection myConnection = new MySqlConnection("Persist Security Info=False;
database=test;server=myServer");
myConnection.Open();
MySqlTransaction myTrans = myConnection.BeginTransaction();
string mySelectQuery = "SELECT * FROM myTable";
MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection,myTrans);
myCommand.CommandTimeout = 20;
}
</code>
<code lang="C++">
public:
void CreateMySqlCommand()
{
MySqlConnection* myConnection = new MySqlConnection(S"Persist Security Info=False;
database=test;server=myServer");
myConnection->Open();
MySqlTransaction* myTrans = myConnection->BeginTransaction();
String* mySelectQuery = S"SELECT * FROM myTable";
MySqlCommand* myCommand = new MySqlCommand(mySelectQuery, myConnection, myTrans);
myCommand->CommandTimeout = 20;
};
</code>
</example>
</overloads>


<summary>
Initializes a new instance of the MySqlCommand class.
</summary>
<remarks>
The base constructor initializes all fields to their default values. The
following table shows initial property values for an instance of <see cref="MySqlCommand"/>.
<list type="table">
<listheader>
<term>Properties</term>
<term>Initial Value</term>
</listheader>
<item>
<term>
<see cref="CommandText"/>
</term>
<term>empty string ("")</term>
</item>
<item>
<term>
<see cref="CommandTimeout"/>
</term>
<term>0</term>
</item>
<item>
<term>
<see cref="CommandType"/>
</term>
<term>CommandType.Text</term>
</item>
<item>
<term>
<see cref="Connection"/>
</term>
<term>Null</term>
</item>
</list>
<para>
You can change the value for any of these properties through a separate call to
the property.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and
sets some of its properties.

<code lang="vbnet">
Public Sub CreateMySqlCommand()
Dim myCommand As New MySqlCommand()
myCommand.CommandType = CommandType.Text
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand()
{
MySqlCommand myCommand = new MySqlCommand();
myCommand.CommandType = CommandType.Text;
}
</code>
</example>
</ctor1>

<ctor2>
<summary>
Initializes a new instance of the <see cref="MySqlCommand"/> class with the text of the query.
</summary>
<param name="cmdText">The text of the query.</param>
<remarks>
When an instance of <see cref="MySqlCommand"/> is created,
the following read/write properties are set to initial values.

<list type="table">
<listheader>
<term>Properties</term>
<term>Initial Value</term>
</listheader>
<item>
<term>
<see cref="CommandText"/>
</term>
<term>
<i>cmdText</i>
</term>
</item>
<item>
<term>
<see cref="CommandTimeout"/>
</term>
<term>0</term>
</item>
<item>
<term>
<see cref="CommandType"/>
</term>
<term>CommandType.Text</term>
</item>
<item>
<term>
<see cref="Connection"/>
</term>
<term>Null</term>
</item>
</list>
<para>
You can change the value for any of these properties through a separate call to
the property.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and
sets some of its properties.

<code lang="vbnet">
Public Sub CreateMySqlCommand()
Dim sql as String = "SELECT * FROM mytable"
Dim myCommand As New MySqlCommand(sql)
myCommand.CommandType = CommandType.Text
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand()
{
string sql = "SELECT * FROM mytable";
MySqlCommand myCommand = new MySqlCommand(sql);
myCommand.CommandType = CommandType.Text;
}
</code>
</example>
</ctor2>

<ctor3>
<summary>
Initializes a new instance of the <see cref="MySqlCommand"/> class
with the text of the query and a <see cref="MySqlConnection"/>.
</summary>
<param name="cmdText">The text of the query.</param>
<param name="connection">
A <see cref="MySqlConnection"/> that represents the
connection to an instance of SQL Server.
</param>
<remarks>
When an instance of <see cref="MySqlCommand"/> is created,
the following read/write properties are set to initial values.

<list type="table">
<listheader>
<term>Properties</term>
<term>Initial Value</term>
</listheader>
<item>
<term>
<see cref="CommandText"/>
</term>
<term>
<i>cmdText</i>
</term>
</item>
<item>
<term>
<see cref="CommandTimeout"/>
</term>
<term>0</term>
</item>
<item>
<term>
<see cref="CommandType"/>
</term>
<term>CommandType.Text</term>
</item>
<item>
<term>
<see cref="Connection"/>
</term>
<term>
<i>connection</i>
</term>
</item>
</list>
<para>
You can change the value for any of these properties through a separate call to
the property.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and
sets some of its properties.

<code lang="vbnet">
Public Sub CreateMySqlCommand()
Dim conn as new MySqlConnection("server=myServer")
Dim sql as String = "SELECT * FROM mytable"
Dim myCommand As New MySqlCommand(sql, conn)
myCommand.CommandType = CommandType.Text
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand()
{
MySqlConnection conn = new MySqlConnection("server=myserver")
string sql = "SELECT * FROM mytable";
MySqlCommand myCommand = new MySqlCommand(sql, conn);
myCommand.CommandType = CommandType.Text;
}
</code>
</example>


</ctor3>

<ctor4>
<summary>
Initializes a new instance of the <see cref="MySqlCommand"/> class
with the text of the query, a <see cref="MySqlConnection"/>, and the
<see cref="MySqlTransaction"/>.
</summary>

<param name="cmdText">The text of the query.</param>
<param name="connection">
A <see cref="MySqlConnection"/> that represents the
connection to an instance of SQL Server.
</param>
<param name="transaction">
The <see cref="MySqlTransaction"/> in which the <see cref="MySqlCommand"/> executes.
</param>
<remarks>
When an instance of <see cref="MySqlCommand"/> is created,
the following read/write properties are set to initial values.

<list type="table">
<listheader>
<term>Properties</term>
<term>Initial Value</term>
</listheader>
<item>
<term>
<see cref="CommandText"/>
</term>
<term>
<i>cmdText</i>
</term>
</item>
<item>
<term>
<see cref="CommandTimeout"/>
</term>
<term>0</term>
</item>
<item>
<term>
<see cref="CommandType"/>
</term>
<term>CommandType.Text</term>
</item>
<item>
<term>
<see cref="Connection"/>
</term>
<term>
<i>connection</i>
</term>
</item>
</list>
<para>
You can change the value for any of these properties through a separate call to
the property.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and
sets some of its properties.

<code lang="vbnet">
Public Sub CreateMySqlCommand()
Dim conn as new MySqlConnection("server=myServer")
conn.Open();
Dim txn as MySqlTransaction = conn.BeginTransaction()
Dim sql as String = "SELECT * FROM mytable"
Dim myCommand As New MySqlCommand(sql, conn, txn)
myCommand.CommandType = CommandType.Text
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand()
{
MySqlConnection conn = new MySqlConnection("server=myserver")
conn.Open();
MySqlTransaction txn = conn.BeginTransaction();
string sql = "SELECT * FROM mytable";
MySqlCommand myCommand = new MySqlCommand(sql, conn, txn);
myCommand.CommandType = CommandType.Text;
}
</code>
</example>

</ctor4>




<ExecuteNonQuery>
<summary>
Executes a SQL statement against the connection and returns the number of rows affected.
</summary>
<returns>Number of rows affected</returns>
<remarks>
You can use ExecuteNonQuery to perform any type of database operation,
however any resultsets returned will not be available. Any output parameters
used in calling a stored procedure will be populated with data and can be
retrieved after execution is complete.
For UPDATE, INSERT, and DELETE statements, the return value is the number
of rows affected by the command. For all other types of statements, the return
value is -1.
</remarks>
<example>
The following example creates a MySqlCommand and then
executes it using ExecuteNonQuery. The example is passed a string that is a
SQL statement (such as UPDATE, INSERT, or DELETE) and a string to use to
connect to the data source.
<code lang="vbnet">
Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As MySqlConnection)
Dim myCommand As New MySqlCommand(myExecuteQuery, myConnection)
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand(string myExecuteQuery, MySqlConnection myConnection)
{
MySqlCommand myCommand = new MySqlCommand(myExecuteQuery, myConnection);
myCommand.Connection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();
}
</code>
</example>
</ExecuteNonQuery>

<ExecuteReader1>
<summary>
Sends the <see cref="CommandText"/> to the <see cref="MySqlConnection">Connection</see>,
and builds a <see cref="MySqlDataReader"/> using one of the <see cref="CommandBehavior"/> values.
</summary>
<param name="behavior">
One of the <see cref="CommandBehavior"/> values.
</param>
<remarks>
<para>
When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
the <see cref="CommandText"/> property should be set to the name of the stored
procedure. The command executes this stored procedure when you call
<B>ExecuteReader</B>.
</para>
<para>
The <see cref="MySqlDataReader"/> supports a special mode that enables large binary
values to be read efficiently. For more information, see the <B>SequentialAccess</B>
setting for <see cref="CommandBehavior"/>.
</para>
<para>
While the <see cref="MySqlDataReader"/> is in use, the associated
<see cref="MySqlConnection"/> is busy serving the <B>MySqlDataReader</B>.
While in this state, no other operations can be performed on the
<B>MySqlConnection</B> other than closing it. This is the case until the
<see cref="MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
If the <B>MySqlDataReader</B> is created with <B>CommandBehavior</B> set to
<B>CloseConnection</B>, closing the <B>MySqlDataReader</B> closes the connection
automatically.
</para>
<note>
When calling ExecuteReader with the SingleRow behavior, you should be aware that using a <i>limit</i>
clause in your SQL will cause all rows (up to the limit given) to be retrieved by the client. The
<see cref="MySqlDataReader.Read"/> method will still return false after the first row but pulling all rows of data
into the client will have a performance impact. If the <i>limit</i> clause is not necessary, it should
be avoided.
</note>
</remarks>
<returns>
A <see cref="MySqlDataReader"/> object.
</returns>
</ExecuteReader1>


<ExecuteReader>
<summary>
Sends the <see cref="CommandText"/> to the <see cref="MySqlConnection">Connection</see>
and builds a <see cref="MySqlDataReader"/>.
</summary>
<returns>
A <see cref="MySqlDataReader"/> object.
</returns>
<remarks>
<para>
When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
the <see cref="CommandText"/> property should be set to the name of the stored
procedure. The command executes this stored procedure when you call
<B>ExecuteReader</B>.
</para>
<para>
While the <see cref="MySqlDataReader"/> is in use, the associated
<see cref="MySqlConnection"/> is busy serving the <B>MySqlDataReader</B>.
While in this state, no other operations can be performed on the
<B>MySqlConnection</B> other than closing it. This is the case until the
<see cref="MySqlDataReader.Close"/> method of the <B>MySqlDataReader</B> is called.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/>, then executes it by
passing a string that is a SQL SELECT statement, and a string to use to connect to the
data source.
<code lang="vbnet">
Public Sub CreateMySqlDataReader(mySelectQuery As String, myConnection As MySqlConnection)
Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As MySqlDataReader
myReader = myCommand.ExecuteReader()
Try
While myReader.Read()
Console.WriteLine(myReader.GetString(0))
End While
Finally
myReader.Close
myConnection.Close
End Try
End Sub
</code>
<code lang="C#">
public void CreateMySqlDataReader(string mySelectQuery, MySqlConnection myConnection)
{
MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
myConnection.Open();
MMySqlDataReader myReader;
myReader = myCommand.ExecuteReader();
try
{
while(myReader.Read())
{
Console.WriteLine(myReader.GetString(0));
}
}
finally
{
myReader.Close();
myConnection.Close();
}
}
</code>
</example>
</ExecuteReader>


<Prepare>
<summary>
Creates a prepared version of the command on an instance of MySQL Server.
</summary>
<remarks>
<para>
Prepared statements are only supported on MySQL version 4.1 and higher. Calling
prepare while connected to earlier versions of MySQL will succeed but will execute
the statement in the same way as unprepared.
</para>
</remarks>
<example>
The following example demonstrates the use of the <b>Prepare</b> method.
<code lang="VB.NET">
public sub PrepareExample()
Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection)
cmd.Parameters.Add( "@val", 10 )
cmd.Prepare()
cmd.ExecuteNonQuery()

cmd.Parameters(0).Value = 20
cmd.ExecuteNonQuery()
end sub
</code>
<code lang="C#">
private void PrepareExample()
{
MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection);
cmd.Parameters.Add( "@val", 10 );
cmd.Prepare();
cmd.ExecuteNonQuery();

cmd.Parameters[0].Value = 20;
cmd.ExecuteNonQuery();
}
</code>
</example>
</Prepare>

<ExecuteScalar>
<summary>
Executes the query, and returns the first column of the first row in the
result set returned by the query. Extra columns or rows are ignored.
</summary>
<returns>
The first column of the first row in the result set, or a null reference if the
result set is empty
</returns>
<remarks>
<para>
Use the <B>ExecuteScalar</B> method to retrieve a single value (for example,
an aggregate value) from a database. This requires less code than using the
<see cref="ExecuteReader()"/> method, and then performing the operations necessary
to generate the single value using the data returned by a <see cref="MySqlDataReader"/>
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and then
executes it using <B>ExecuteScalar</B>. The example is passed a string that is a
SQL statement that returns an aggregate result, and a string to use to
connect to the data source.

<code lang="vbnet">
Public Sub CreateMySqlCommand(myScalarQuery As String, myConnection As MySqlConnection)
Dim myCommand As New MySqlCommand(myScalarQuery, myConnection)
myCommand.Connection.Open()
myCommand.ExecuteScalar()
myConnection.Close()
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand(string myScalarQuery, MySqlConnection myConnection)
{
MySqlCommand myCommand = new MySqlCommand(myScalarQuery, myConnection);
myCommand.Connection.Open();
myCommand.ExecuteScalar();
myConnection.Close();
}
</code>
<code lang="C++">
public:
void CreateMySqlCommand(String* myScalarQuery, MySqlConnection* myConnection)
{
MySqlCommand* myCommand = new MySqlCommand(myScalarQuery, myConnection);
myCommand-&gt;Connection-&gt;Open();
myCommand-&gt;ExecuteScalar();
myConnection-&gt;Close();
}
</code>

</example>
</ExecuteScalar>

<CommandText>
<summary>
Gets or sets the SQL statement to execute at the data source.
</summary>
<value>
The SQL statement or stored procedure to execute. The default is an empty string.
</value>
<remarks>
<para>
When the <see cref="CommandType"/> property is set to <B>StoredProcedure</B>,
the <B>CommandText</B> property should be set to the name of the stored procedure.
The user may be required to use escape character syntax if the stored procedure name
contains any special characters. The command executes this stored procedure when
you call one of the Execute methods. Starting with Connector/Net 5.0, having both a stored function
and stored procedure with the same name in the same database is not supported. It is
suggested that you provide unqiue names for your stored routines.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
<code lang="vbnet">
Public Sub CreateMySqlCommand()
Dim myCommand As New MySqlCommand()
myCommand.CommandText = "SELECT * FROM Mytable ORDER BY id"
myCommand.CommandType = CommandType.Text
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand()
{
MySqlCommand myCommand = new MySqlCommand();
myCommand.CommandText = "SELECT * FROM mytable ORDER BY id";
myCommand.CommandType = CommandType.Text;
}
</code>
</example>
</CommandText>

<CommandTimeout>
<summary>
Gets or sets the wait time before terminating the attempt to execute a command
and generating an error.
</summary>
<value>
The time (in seconds) to wait for the command to execute. The default is 30
seconds.
</value>
<remarks>
CommandTimeout is dependent on the ability of MySQL to cancel an executing query.
Because of this, CommandTimeout is only supported when connected to MySQL
version 5.0.0 or higher.
</remarks>
</CommandTimeout>

<CommandType>
<summary>
Gets or sets a value indicating how the <see cref="CommandText"/> property is to be interpreted.
</summary>
<value>
One of the <see cref="System.Data.CommandType"/> values. The default is <B>Text</B>.
</value>
<remarks>
<para>
When you set the <B>CommandType</B> property to <B>StoredProcedure</B>, you
should set the <see cref="CommandText"/> property to the name of the stored
procedure. The command executes this stored procedure when you call one of the
Execute methods.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
<code lang="vbnet">
Public Sub CreateMySqlCommand()
Dim myCommand As New MySqlCommand()
myCommand.CommandType = CommandType.Text
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand()
{
MySqlCommand myCommand = new MySqlCommand();
myCommand.CommandType = CommandType.Text;
}
</code>
</example>
</CommandType>





<Connection>
<summary>
Gets or sets the <see cref="MySqlConnection"/> used by this instance of the
<see cref="MySqlCommand"/>.
</summary>
<value>
The connection to a data source. The default value is a null reference
(<B>Nothing</B> in Visual Basic).
</value>
<remarks>
<para>
If you set <B>Connection</B> while a transaction is in progress and the
<see cref="Transaction"/> property is not null, an <see cref="InvalidOperationException"/>
is generated. If the <B>Transaction</B> property is not null and the transaction
has already been committed or rolled back, <B>Transaction</B> is set to
null.
</para>
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
<code lang="vbnet">
Public Sub CreateMySqlCommand()
Dim mySelectQuery As String = "SELECT * FROM mytable ORDER BY id"
Dim myConnectString As String = "Persist Security Info=False;database=test;server=myServer"
Dim myCommand As New MySqlCommand(mySelectQuery)
myCommand.Connection = New MySqlConnection(myConnectString)
myCommand.CommandType = CommandType.Text
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand()
{
string mySelectQuery = "SELECT * FROM mytable ORDER BY id";
string myConnectString = "Persist Security Info=False;database=test;server=myServer";
MySqlCommand myCommand = new MySqlCommand(mySelectQuery);
myCommand.Connection = new MySqlConnection(myConnectString);
myCommand.CommandType = CommandType.Text;
}
</code>
</example>
</Connection>

<IsPrepared>
</IsPrepared>

<LastInsertedId>
<summary>Provides the id of the last inserted row.</summary>
<value>
Id of the last inserted row. -1 if none exists.
</value>
<remarks>
An important point to remember is that this property can be used
in batch SQL scenarios but it's important to remember that it will
only reflect the insert id from the last insert statement in the batch.

This property can also be used when the batch includes select statements
and ExecuteReader is used. This property can be consulted during result set
processing.
</remarks>
</LastInsertedId>

<Parameters>
<summary>
Get the <see cref="MySqlParameterCollection"/>
</summary>
<value>
The parameters of the SQL statement or stored procedure. The default is
an empty collection.
</value>
<remarks>
Connector/Net does not support unnamed parameters. Every parameter added to the collection must
have an associated name.
</remarks>
<example>
The following example creates a <see cref="MySqlCommand"/> and displays its parameters.
To accomplish this, the method is passed a <see cref="MySqlConnection"/>, a query string
that is a SQL SELECT statement, and an array of <see cref="MySqlParameter"/> objects.
<code lang="vbnet">
Public Sub CreateMySqlCommand(myConnection As MySqlConnection, _
mySelectQuery As String, myParamArray() As MySqlParameter)
Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age"
myCommand.UpdatedRowSource = UpdateRowSource.Both
myCommand.Parameters.Add(myParamArray)
Dim j As Integer
For j = 0 To myCommand.Parameters.Count - 1
myCommand.Parameters.Add(myParamArray(j))
Next j
Dim myMessage As String = ""
Dim i As Integer
For i = 0 To myCommand.Parameters.Count - 1
myMessage += myCommand.Parameters(i).ToString() &amp; ControlChars.Cr
Next i
Console.WriteLine(myMessage)
End Sub
</code>
<code lang="C#">
public void CreateMySqlCommand(MySqlConnection myConnection, string mySelectQuery,
MySqlParameter[] myParamArray)
{
MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age";
myCommand.Parameters.Add(myParamArray);
for (int j=0; j&lt;myParamArray.Length; j++)
{
myCommand.Parameters.Add(myParamArray[j]) ;
}
string myMessage = "";
for (int i = 0; i &lt; myCommand.Parameters.Count; i++)
{
myMessage += myCommand.Parameters[i].ToString() + "\n";
}
MessageBox.Show(myMessage);
}
</code>
</example>
</Parameters>

<Transaction>
<summary>
Gets or sets the <see cref="MySqlTransaction"/> within which the <see cref="MySqlCommand"/> executes.
</summary>
<value>
The <see cref="MySqlTransaction"/>. The default value is a null reference (<B>Nothing</B> in Visual Basic).
</value>
<remarks>
You cannot set the <B>Transaction</B> property if it is already set to a
specific value, and the command is in the process of executing. If you set the
transaction property to a <see cref="MySqlTransaction"/> object that is not connected
to the same <see cref="MySqlConnection"/> as the <see cref="MySqlCommand"/> object,
an exception will be thrown the next time you attempt to execute a statement.
</remarks>
</Transaction>

<UpdatedRowSource>
<summary>
Gets or sets how command results are applied to the <see cref="DataRow"/>
when used by the <see cref="System.Data.Common.DbDataAdapter.Update"/> method
of the <see cref="System.Data.Common.DbDataAdapter"/>.
</summary>
<value>
One of the <see cref="UpdateRowSource"/> values.
</value>
<remarks>
<para>
The default <see cref="System.Data.UpdateRowSource"/> value is
<B>Both</B> unless the command is automatically generated (as in the case of the
<see cref="MySqlCommandBuilder"/>), in which case the default is <B>None</B>.
</para>
</remarks>
</UpdatedRowSource>

</docs>

+ 321
- 0
Teknik/docs/MySqlCommandBuilder.xml View File

@@ -0,0 +1,321 @@
<docs>
<class>
<summary>
Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated MySQL database. This class cannot be inherited.
</summary>
<remarks>
<para>
The <see cref="MySqlDataAdapter"/> does not automatically generate the SQL statements required to
reconcile changes made to a <see cref="System.Data.DataSet">DataSet</see> with the associated instance of MySQL.
However, you can create a <B>MySqlCommandBuilder</B> object to automatically generate SQL statements for
single-table updates if you set the <see cref="MySqlDataAdapter.SelectCommand">SelectCommand</see> property
of the <B>MySqlDataAdapter</B>. Then, any additional SQL statements that you do not set are generated by the
<B>MySqlCommandBuilder</B>.
</para>

<para>
The <B>MySqlCommandBuilder</B> registers itself as a listener for <see cref="MySqlDataAdapter.OnRowUpdating">RowUpdating</see>
events whenever you set the <see cref="DataAdapter"/> property. You can only associate one
<B>MySqlDataAdapter</B> or <B>MySqlCommandBuilder</B> object with each other at one time.
</para>

<para>
To generate INSERT, UPDATE, or DELETE statements, the <B>MySqlCommandBuilder</B> uses the
<B>SelectCommand</B> property to retrieve a required set of metadata automatically. If you change
the <B>SelectCommand</B> after the metadata has is retrieved (for example, after the first update), you
should call the <see cref="RefreshSchema"/> method to update the metadata.
</para>

<para>
The <B>SelectCommand</B> must also return at least one primary key or unique
column. If none are present, an <I>InvalidOperation</I> exception is generated,
and the commands are not generated.
</para>

<para>
The <B>MySqlCommandBuilder</B> also uses the <see cref="MySqlCommand.Connection">Connection</see>,
<see cref="MySqlCommand.CommandTimeout">CommandTimeout</see>, and <see cref="MySqlCommand.Transaction">Transaction</see>
properties referenced by the <B>SelectCommand</B>. The user should call
<B>RefreshSchema</B> if any of these properties are modified, or if the
<B>SelectCommand</B> itself is replaced. Otherwise the <see cref="MySqlDataAdapter.InsertCommand">InsertCommand</see>,
<see cref="MySqlDataAdapter.UpdateCommand">UpdateCommand</see>, and
<see cref="MySqlDataAdapter.DeleteCommand">DeleteCommand</see> properties retain
their previous values.
</para>

<para>
If you call <i>Dispose</i>, the <B>MySqlCommandBuilder</B> is disassociated
from the <B>MySqlDataAdapter</B>, and the generated commands are no longer used.
</para>

<note>
Caution must be used when using MySqlCOmmandBuilder on MySql 4.0 systems. With MySql 4.0,
database/schema information is not provided to the connector for a query. This means that
a query that pulls columns from two identically named tables in two or more different databases
will not cause an exception to be thrown but will not work correctly. Even more dangerous
is the situation where your select statement references database X but is executed in
database Y and both databases have tables with similar layouts. This situation can cause
unwanted changes or deletes.
This note does not apply to MySQL versions 4.1 and later.
</note>

</remarks>

<example>
The following example uses the <see cref="MySqlCommand"/>, along
<see cref="MySqlDataAdapter"/> and <see cref="MySqlConnection"/>, to
select rows from a data source. The example is passed an initialized
<see cref="System.Data.DataSet"/>, a connection string, a
query string that is a SQL SELECT statement, and a string that is the
name of the database table. The example then creates a <B>MySqlCommandBuilder</B>.

<code lang="vbnet">
Public Shared Function SelectRows(myConnection As String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New MySqlConnection(myConnection)
Dim myDataAdapter As New MySqlDataAdapter()
myDataAdapter.SelectCommand = New MySqlCommand(mySelectQuery, myConn)
Dim cb As SqlCommandBuilder = New MySqlCommandBuilder(myDataAdapter)

myConn.Open()

Dim ds As DataSet = New DataSet
myDataAdapter.Fill(ds, myTableName)

' Code to modify data in DataSet here

' Without the MySqlCommandBuilder this line would fail.
myDataAdapter.Update(ds, myTableName)

myConn.Close()
End Function 'SelectRows
</code>
<code lang="C#">
public static DataSet SelectRows(string myConnection, string mySelectQuery, string myTableName)
{
MySqlConnection myConn = new MySqlConnection(myConnection);
MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
myDataAdapter.SelectCommand = new MySqlCommand(mySelectQuery, myConn);
MySqlCommandBuilder cb = new MySqlCommandBuilder(myDataAdapter);

myConn.Open();

DataSet ds = new DataSet();
myDataAdapter.Fill(ds, myTableName);

//code to modify data in DataSet here

//Without the MySqlCommandBuilder this line would fail
myDataAdapter.Update(ds, myTableName);

myConn.Close();

return ds;
}

</code>
</example>
</class>

<Ctor>
<summary>
Initializes a new instance of the <see cref="MySqlCommandBuilder"/> class.
</summary>
</Ctor>

<Ctor2>
<summary>
Initializes a new instance of the <see cref="MySqlCommandBuilder"/> class
with the associated <see cref="MySqlDataAdapter"/> object.
</summary>
<param name="adapter">
The <see cref="MySqlDataAdapter"/> to use.
</param>
<remarks>
<para>
The <see cref="MySqlCommandBuilder"/> registers itself as a listener for
<see cref="MySqlDataAdapter.RowUpdating"/> events that are generated by the
<see cref="MySqlDataAdapter"/> specified in this property.
</para>
<para>
When you create a new instance <B>MySqlCommandBuilder</B>, any existing
<B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
is released.
</para>
</remarks>
</Ctor2>


<DataAdapter>
<summary>
Gets or sets a <see cref="MySqlDataAdapter"/> object for which SQL statements are automatically generated.
</summary>
<value>
A <see cref="MySqlDataAdapter"/> object.
</value>
<remarks>
<para>
The <see cref="MySqlCommandBuilder"/> registers itself as a listener for
<see cref="MySqlDataAdapter.RowUpdating"/> events that are generated by the
<see cref="MySqlDataAdapter"/> specified in this property.
</para>
<para>
When you create a new instance <B>MySqlCommandBuilder</B>, any existing
<B>MySqlCommandBuilder</B> associated with this <B>MySqlDataAdapter</B>
is released.
</para>
</remarks>
</DataAdapter>

<QuotePrefix>
<summary>
Gets or sets the beginning character or characters to use when specifying MySQL
database objects (for example, tables or columns) whose names contain
characters such as spaces or reserved tokens.
</summary>
<value>
The beginning character or characters to use. The default value is `.
</value>
<remarks>
Database objects in MySQL can contain special characters such as spaces that would
make normal SQL strings impossible to correctly parse. Use of the <b>QuotePrefix</b>
and the <see cref="QuoteSuffix"/> properties allows the <see cref="MySqlCommandBuilder"/>
to build SQL commands that handle this situation.
</remarks>
</QuotePrefix>