content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2 values |
|---|---|---|---|---|---|---|---|---|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Security.Permissions
{
[Serializable]
public sealed partial class StrongNameIdentityPermission : CodeAccessPermission
{
public StrongNameIdentityPermission(PermissionState state) { }
public StrongNameIdentityPermission(StrongNamePublicKeyBlob blob, string name, Version version) { }
public string Name { get; set; }
public StrongNamePublicKeyBlob PublicKey { get; set; }
public Version Version { get; set; }
public override IPermission Copy() { return this; }
public override void FromXml(SecurityElement e) { }
public override IPermission Intersect(IPermission target) { return default(IPermission); }
public override bool IsSubsetOf(IPermission target) { return false; }
public override SecurityElement ToXml() { return default(SecurityElement); }
public override IPermission Union(IPermission target) { return default(IPermission); }
}
}
| 50.73913 | 107 | 0.727506 | [
"MIT"
] | Aevitas/corefx | src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermission.cs | 1,169 | C# |
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.IO;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Skinning;
namespace osu.Game.Tests.Beatmaps
{
[TestFixture]
public abstract class BeatmapConversionTest<TConvertMapping, TConvertValue>
where TConvertMapping : ConvertMapping<TConvertValue>, IEquatable<TConvertMapping>, new()
where TConvertValue : IEquatable<TConvertValue>
{
private const string resource_namespace = "Testing.Beatmaps";
private const string expected_conversion_suffix = "-expected-conversion";
protected abstract string ResourceAssembly { get; }
protected void Test(string name, params Type[] mods)
{
var ourResult = convert(name, mods.Select(m => (Mod)Activator.CreateInstance(m)).ToArray());
var expectedResult = read(name);
foreach (var m in ourResult.Mappings)
m.PostProcess();
foreach (var m in expectedResult.Mappings)
m.PostProcess();
Assert.Multiple(() =>
{
int mappingCounter = 0;
while (true)
{
if (mappingCounter >= ourResult.Mappings.Count && mappingCounter >= expectedResult.Mappings.Count)
break;
if (mappingCounter >= ourResult.Mappings.Count)
Assert.Fail($"A conversion did not generate any hitobjects, but should have, for hitobject at time: {expectedResult.Mappings[mappingCounter].StartTime}\n");
else if (mappingCounter >= expectedResult.Mappings.Count)
Assert.Fail($"A conversion generated hitobjects, but should not have, for hitobject at time: {ourResult.Mappings[mappingCounter].StartTime}\n");
else if (!expectedResult.Mappings[mappingCounter].Equals(ourResult.Mappings[mappingCounter]))
{
var expectedMapping = expectedResult.Mappings[mappingCounter];
var ourMapping = ourResult.Mappings[mappingCounter];
Assert.Fail($"The conversion mapping differed for object at time {expectedMapping.StartTime}:\n"
+ $"Expected {JsonConvert.SerializeObject(expectedMapping)}\n"
+ $"Received: {JsonConvert.SerializeObject(ourMapping)}\n");
}
else
{
var ourMapping = ourResult.Mappings[mappingCounter];
var expectedMapping = expectedResult.Mappings[mappingCounter];
Assert.Multiple(() =>
{
int objectCounter = 0;
while (true)
{
if (objectCounter >= ourMapping.Objects.Count && objectCounter >= expectedMapping.Objects.Count)
break;
if (objectCounter >= ourMapping.Objects.Count)
{
Assert.Fail($"The conversion did not generate a hitobject, but should have, for hitobject at time: {expectedMapping.StartTime}:\n"
+ $"Expected: {JsonConvert.SerializeObject(expectedMapping.Objects[objectCounter])}\n");
}
else if (objectCounter >= expectedMapping.Objects.Count)
{
Assert.Fail($"The conversion generated a hitobject, but should not have, for hitobject at time: {ourMapping.StartTime}:\n"
+ $"Received: {JsonConvert.SerializeObject(ourMapping.Objects[objectCounter])}\n");
}
else if (!expectedMapping.Objects[objectCounter].Equals(ourMapping.Objects[objectCounter]))
{
Assert.Fail($"The conversion generated differing hitobjects for object at time: {expectedMapping.StartTime}:\n"
+ $"Expected: {JsonConvert.SerializeObject(expectedMapping.Objects[objectCounter])}\n"
+ $"Received: {JsonConvert.SerializeObject(ourMapping.Objects[objectCounter])}\n");
}
objectCounter++;
}
});
}
mappingCounter++;
}
});
}
private ConvertResult convert(string name, Mod[] mods)
{
var beatmap = GetBeatmap(name);
var converterResult = new Dictionary<HitObject, IEnumerable<HitObject>>();
var working = new ConversionWorkingBeatmap(beatmap)
{
ConversionGenerated = (o, r, c) =>
{
converterResult[o] = r;
OnConversionGenerated(o, r, c);
}
};
working.GetPlayableBeatmap(CreateRuleset().RulesetInfo, mods);
return new ConvertResult
{
Mappings = converterResult.Select(r =>
{
var mapping = CreateConvertMapping(r.Key);
mapping.StartTime = r.Key.StartTime;
mapping.Objects.AddRange(r.Value.SelectMany(CreateConvertValue));
return mapping;
}).ToList()
};
}
protected virtual void OnConversionGenerated(HitObject original, IEnumerable<HitObject> result, IBeatmapConverter beatmapConverter)
{
}
private ConvertResult read(string name)
{
using (var resStream = openResource($"{resource_namespace}.{name}{expected_conversion_suffix}.json"))
using (var reader = new StreamReader(resStream))
{
var contents = reader.ReadToEnd();
return JsonConvert.DeserializeObject<ConvertResult>(contents);
}
}
public IBeatmap GetBeatmap(string name)
{
using (var resStream = openResource($"{resource_namespace}.{name}.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var decoder = Decoder.GetDecoder<Beatmap>(stream);
((LegacyBeatmapDecoder)decoder).ApplyOffsets = false;
var beatmap = decoder.Decode(stream);
var rulesetInstance = CreateRuleset();
beatmap.BeatmapInfo.Ruleset = beatmap.BeatmapInfo.RulesetID == rulesetInstance.RulesetInfo.ID ? rulesetInstance.RulesetInfo : new RulesetInfo();
return beatmap;
}
}
private Stream openResource(string name)
{
var localPath = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)).AsNonNull();
return Assembly.LoadFrom(Path.Combine(localPath, $"{ResourceAssembly}.dll")).GetManifestResourceStream($@"{ResourceAssembly}.Resources.{name}");
}
/// <summary>
/// Creates the conversion mapping for a <see cref="HitObject"/>. A conversion mapping stores important information about the conversion process.
/// This is generated _after_ the <see cref="HitObject"/> has been converted.
/// <para>
/// This should be used to validate the integrity of the conversion process after a conversion has occurred.
/// </para>
/// </summary>
protected virtual TConvertMapping CreateConvertMapping(HitObject source) => new TConvertMapping();
/// <summary>
/// Creates the conversion value for a <see cref="HitObject"/>. A conversion value stores information about the converted <see cref="HitObject"/>.
/// <para>
/// This should be used to validate the integrity of the converted <see cref="HitObject"/>.
/// </para>
/// </summary>
/// <param name="hitObject">The converted <see cref="HitObject"/>.</param>
protected abstract IEnumerable<TConvertValue> CreateConvertValue(HitObject hitObject);
/// <summary>
/// Creates the <see cref="Ruleset"/> applicable to this <see cref="BeatmapConversionTest{TConvertMapping,TConvertValue}"/>.
/// </summary>
protected abstract Ruleset CreateRuleset();
private class ConvertResult
{
[JsonProperty]
public List<TConvertMapping> Mappings = new List<TConvertMapping>();
}
private class ConversionWorkingBeatmap : WorkingBeatmap
{
public Action<HitObject, IEnumerable<HitObject>, IBeatmapConverter> ConversionGenerated;
private readonly IBeatmap beatmap;
public ConversionWorkingBeatmap(IBeatmap beatmap)
: base(beatmap.BeatmapInfo, null)
{
this.beatmap = beatmap;
}
protected override IBeatmap GetBeatmap() => beatmap;
protected override Texture GetBackground() => throw new NotImplementedException();
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
protected override ISkin GetSkin() => throw new NotImplementedException();
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
protected override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
{
var converter = base.CreateBeatmapConverter(beatmap, ruleset);
converter.ObjectConverted += (orig, converted) => ConversionGenerated?.Invoke(orig, converted, converter);
return converter;
}
}
}
public abstract class BeatmapConversionTest<TConvertValue> : BeatmapConversionTest<ConvertMapping<TConvertValue>, TConvertValue>
where TConvertValue : IEquatable<TConvertValue>
{
}
public class ConvertMapping<TConvertValue> : IEquatable<ConvertMapping<TConvertValue>>
where TConvertValue : IEquatable<TConvertValue>
{
[JsonProperty]
public double StartTime;
[JsonIgnore]
public List<TConvertValue> Objects = new List<TConvertValue>();
[JsonProperty("Objects")]
private List<TConvertValue> setObjects
{
set => Objects = value;
}
/// <summary>
/// Invoked after this <see cref="ConvertMapping{TConvertValue}"/> is populated to post-process the contained data.
/// </summary>
public virtual void PostProcess()
{
}
public virtual bool Equals(ConvertMapping<TConvertValue> other) => StartTime == other?.StartTime;
}
}
| 44.91635 | 181 | 0.570727 | [
"MIT"
] | 02Naitsirk/osu | osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs | 11,553 | C# |
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public static class HintAssist
{
#region UseFloating
public static readonly DependencyProperty IsFloatingProperty = DependencyProperty.RegisterAttached(
"IsFloating",
typeof(bool),
typeof(HintAssist),
new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.Inherits));
public static bool GetIsFloating(DependencyObject element)
{
return (bool) element.GetValue(IsFloatingProperty);
}
public static void SetIsFloating(DependencyObject element, bool value)
{
element.SetValue(IsFloatingProperty, value);
}
#endregion
#region FloatingScale & FloatingOffset
public static readonly DependencyProperty FloatingScaleProperty = DependencyProperty.RegisterAttached(
"FloatingScale",
typeof(double),
typeof(HintAssist),
new FrameworkPropertyMetadata(0.74d, FrameworkPropertyMetadataOptions.Inherits));
public static double GetFloatingScale(DependencyObject element)
{
return (double)element.GetValue(FloatingScaleProperty);
}
public static void SetFloatingScale(DependencyObject element, double value)
{
element.SetValue(FloatingScaleProperty, value);
}
public static readonly DependencyProperty FloatingOffsetProperty = DependencyProperty.RegisterAttached(
"FloatingOffset",
typeof(Point),
typeof(HintAssist),
new FrameworkPropertyMetadata(new Point(1, -16), FrameworkPropertyMetadataOptions.Inherits));
public static Point GetFloatingOffset(DependencyObject element)
{
return (Point)element.GetValue(FloatingOffsetProperty);
}
public static void SetFloatingOffset(DependencyObject element, Point value)
{
element.SetValue(FloatingOffsetProperty, value);
}
#endregion
#region Hint
/// <summary>
/// The hint property
/// </summary>
public static readonly DependencyProperty HintProperty = DependencyProperty.RegisterAttached(
"Hint",
typeof(object),
typeof(HintAssist),
new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.Inherits));
/// <summary>
/// Sets the hint.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="value">The value.</param>
public static void SetHint(DependencyObject element, object value)
{
element.SetValue(HintProperty, value);
}
/// <summary>
/// Gets the hint.
/// </summary>
/// <param name="element">The element.</param>
/// <returns>
/// The <see cref="string" />.
/// </returns>
public static object GetHint(DependencyObject element)
{
return element.GetValue(HintProperty);
}
#endregion
#region HintOpacity
/// <summary>
/// The hint opacity property
/// </summary>
public static readonly DependencyProperty HintOpacityProperty = DependencyProperty.RegisterAttached(
"HintOpacity",
typeof(double),
typeof(HintAssist),
new PropertyMetadata(.56));
/// <summary>
/// Gets the text box view margin.
/// </summary>
/// <param name="element">The element.</param>
/// <returns>
/// The <see cref="Thickness" />.
/// </returns>
public static double GetHintOpacityProperty(DependencyObject element)
{
return (double)element.GetValue(HintOpacityProperty);
}
/// <summary>
/// Sets the hint opacity.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="value">The value.</param>
public static void SetHintOpacity(DependencyObject element, double value)
{
element.SetValue(HintOpacityProperty, value);
}
#endregion
}
} | 32.348485 | 111 | 0.606557 | [
"MIT"
] | 4sami/MaterialDesignInXamlToolkit | MaterialDesignThemes.Wpf/HintAssist.cs | 4,272 | C# |
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.OpenApi.Models;
using Newtonsoft.Json.Linq;
using openapi_to_terraform.Generator.azurerm.v2_45_1.GeneratorModels;
namespace openapi_to_terraform.Generator.azurerm.v2_45_1.Generators
{
public class OperationGenerator
{
public static string GenerateTerraformOutput(OpenApiDocument document, string backendUrl, string policyRootDirectory)
{
var sb = new StringBuilder();
string operation = TerraformApimOperation.GenerateBlock(document, document.Info.Title.ToLower().Replace(" ", "") + $"_rev1", backendUrl, policyRootDirectory);
sb.AppendLine(operation);
return sb.ToString();
}
public static string GenerateTerraformOutput(OpenApiDocument document, string revisionMappingFile, string backendUrl, string policyRootDirectory)
{
// The key for this dict will be an OpenApiDocument.OpenApiPathItem.Key, the value is a string array of the revisions to include that operation in
var revisionsMap = JObject.Parse(File.ReadAllText(revisionMappingFile)).ToObject<Dictionary<string, string[]>>();
var sb = new StringBuilder();
foreach (KeyValuePair<string, string[]> revision in revisionsMap)
{
string operation = TerraformApimOperation.GenerateBlock(document, revision, backendUrl, policyRootDirectory);
sb.AppendLine(operation);
sb.AppendLine();
}
return sb.ToString();
}
}
} | 46.882353 | 170 | 0.692597 | [
"MIT"
] | awaldow/openapi-to-terraform | openapi-to-terraform.Generator/azurerm/v2_45_1/Generators/OperationGenerator.cs | 1,594 | C# |
using System;
namespace Microsoft.Maui.Essentials
{
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="Type[@FullName='Microsoft.Maui.Essentials.DeviceInfo']/Docs" />
public static partial class DeviceInfo
{
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="//Member[@MemberName='Model']/Docs" />
public static string Model => GetModel();
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="//Member[@MemberName='Manufacturer']/Docs" />
public static string Manufacturer => GetManufacturer();
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="//Member[@MemberName='Name']/Docs" />
public static string Name => GetDeviceName();
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="//Member[@MemberName='VersionString']/Docs" />
public static string VersionString => GetVersionString();
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="//Member[@MemberName='Version']/Docs" />
public static Version Version => Utils.ParseVersion(VersionString);
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="//Member[@MemberName='Platform']/Docs" />
public static DevicePlatform Platform => GetPlatform();
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="//Member[@MemberName='Idiom']/Docs" />
public static DeviceIdiom Idiom => GetIdiom();
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceInfo.xml" path="//Member[@MemberName='DeviceType']/Docs" />
public static DeviceType DeviceType => GetDeviceType();
}
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceType.xml" path="Type[@FullName='Microsoft.Maui.Essentials.DeviceType']/Docs" />
public enum DeviceType
{
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceType.xml" path="//Member[@MemberName='Unknown']/Docs" />
Unknown = 0,
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceType.xml" path="//Member[@MemberName='Physical']/Docs" />
Physical = 1,
/// <include file="../../docs/Microsoft.Maui.Essentials/DeviceType.xml" path="//Member[@MemberName='Virtual']/Docs" />
Virtual = 2
}
}
| 51.25 | 142 | 0.701109 | [
"MIT"
] | andres-gimenez/maui | src/Essentials/src/DeviceInfo/DeviceInfo.shared.cs | 2,255 | C# |
namespace LVLTool
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.mBrowseLVL = new System.Windows.Forms.Button();
this.mLVLFileTextBox = new System.Windows.Forms.TextBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.decompileButton = new System.Windows.Forms.RadioButton();
this.listingButton = new System.Windows.Forms.RadioButton();
this.pcLuaCodeButton = new System.Windows.Forms.RadioButton();
this.mSummaryRadioButton = new System.Windows.Forms.RadioButton();
this.mAddItemButton = new System.Windows.Forms.Button();
this.mSaveFileButton = new System.Windows.Forms.Button();
this.mReplaceButton = new System.Windows.Forms.Button();
this.mExtractAllButton = new System.Windows.Forms.Button();
this.mAssetListBox = new System.Windows.Forms.ListBox();
this.mMainTextBox = new LVLTool.SearchTextBox();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.enterBF2ToolsDirToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.createNewLVLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.renameItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.coreMergeFormToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.refreshLvlListBoxToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sortListBoxToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.findToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.findKnownHashToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.localizationMenu = new System.Windows.Forms.ToolStripMenuItem();
this.showAllStringsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.applyStringsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.getToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.setStringMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dumpFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addStringToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.createMungedLocFileFromDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.disableStringsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addStringsifNotAlreadyPresentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutProgramToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.mModToolsLabel = new System.Windows.Forms.Label();
this.mStatusLabel = new System.Windows.Forms.Label();
this.mModToolsSelection = new System.Windows.Forms.ComboBox();
this.runUnmungeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// mBrowseLVL
//
this.mBrowseLVL.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.mBrowseLVL.BackColor = System.Drawing.Color.Gray;
this.mBrowseLVL.Location = new System.Drawing.Point(642, 40);
this.mBrowseLVL.Name = "mBrowseLVL";
this.mBrowseLVL.Size = new System.Drawing.Size(25, 23);
this.mBrowseLVL.TabIndex = 15;
this.mBrowseLVL.Text = "...";
this.mBrowseLVL.UseVisualStyleBackColor = false;
this.mBrowseLVL.Click += new System.EventHandler(this.mBrowseLVL_Click);
//
// mLVLFileTextBox
//
this.mLVLFileTextBox.AllowDrop = true;
this.mLVLFileTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.mLVLFileTextBox.BackColor = System.Drawing.Color.Black;
this.mLVLFileTextBox.ForeColor = System.Drawing.Color.White;
this.mLVLFileTextBox.Location = new System.Drawing.Point(3, 43);
this.mLVLFileTextBox.Name = "mLVLFileTextBox";
this.mLVLFileTextBox.Size = new System.Drawing.Size(633, 20);
this.mLVLFileTextBox.TabIndex = 14;
this.mLVLFileTextBox.TextChanged += new System.EventHandler(this.mLVLFileTextBox_TextChanged);
this.mLVLFileTextBox.DragDrop += new System.Windows.Forms.DragEventHandler(this.textBox_DragDrop);
this.mLVLFileTextBox.DragOver += new System.Windows.Forms.DragEventHandler(this.textBox_DragOver);
//
// splitContainer1
//
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(3, 72);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent;
this.splitContainer1.Panel1.Controls.Add(this.groupBox1);
this.splitContainer1.Panel1.Controls.Add(this.mAddItemButton);
this.splitContainer1.Panel1.Controls.Add(this.mSaveFileButton);
this.splitContainer1.Panel1.Controls.Add(this.mReplaceButton);
this.splitContainer1.Panel1.Controls.Add(this.mExtractAllButton);
this.splitContainer1.Panel1.Controls.Add(this.mAssetListBox);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.mMainTextBox);
this.splitContainer1.Size = new System.Drawing.Size(659, 371);
this.splitContainer1.SplitterDistance = 219;
this.splitContainer1.TabIndex = 19;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.BackColor = System.Drawing.Color.Gray;
this.groupBox1.Controls.Add(this.decompileButton);
this.groupBox1.Controls.Add(this.listingButton);
this.groupBox1.Controls.Add(this.pcLuaCodeButton);
this.groupBox1.Controls.Add(this.mSummaryRadioButton);
this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox1.Location = new System.Drawing.Point(6, 220);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(205, 62);
this.groupBox1.TabIndex = 24;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Lua Code Display";
//
// decompileButton
//
this.decompileButton.AutoSize = true;
this.decompileButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.decompileButton.Location = new System.Drawing.Point(84, 42);
this.decompileButton.Name = "decompileButton";
this.decompileButton.Size = new System.Drawing.Size(115, 17);
this.decompileButton.TabIndex = 3;
this.decompileButton.Text = "Lua (decompile)";
this.decompileButton.UseVisualStyleBackColor = true;
this.decompileButton.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
//
// listingButton
//
this.listingButton.AutoSize = true;
this.listingButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listingButton.Location = new System.Drawing.Point(6, 42);
this.listingButton.Name = "listingButton";
this.listingButton.Size = new System.Drawing.Size(62, 17);
this.listingButton.TabIndex = 2;
this.listingButton.Text = "Listing";
this.listingButton.UseVisualStyleBackColor = true;
this.listingButton.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
//
// pcLuaCodeButton
//
this.pcLuaCodeButton.AutoSize = true;
this.pcLuaCodeButton.Checked = true;
this.pcLuaCodeButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.pcLuaCodeButton.Location = new System.Drawing.Point(84, 19);
this.pcLuaCodeButton.Name = "pcLuaCodeButton";
this.pcLuaCodeButton.Size = new System.Drawing.Size(99, 17);
this.pcLuaCodeButton.TabIndex = 1;
this.pcLuaCodeButton.TabStop = true;
this.pcLuaCodeButton.Text = "PC Lua Code";
this.pcLuaCodeButton.UseVisualStyleBackColor = true;
this.pcLuaCodeButton.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
//
// mSummaryRadioButton
//
this.mSummaryRadioButton.AutoSize = true;
this.mSummaryRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.mSummaryRadioButton.Location = new System.Drawing.Point(6, 19);
this.mSummaryRadioButton.Name = "mSummaryRadioButton";
this.mSummaryRadioButton.Size = new System.Drawing.Size(75, 17);
this.mSummaryRadioButton.TabIndex = 0;
this.mSummaryRadioButton.Text = "Summary";
this.mSummaryRadioButton.UseVisualStyleBackColor = true;
this.mSummaryRadioButton.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
//
// mAddItemButton
//
this.mAddItemButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.mAddItemButton.BackColor = System.Drawing.Color.Gray;
this.mAddItemButton.Location = new System.Drawing.Point(3, 327);
this.mAddItemButton.Name = "mAddItemButton";
this.mAddItemButton.Size = new System.Drawing.Size(84, 23);
this.mAddItemButton.TabIndex = 23;
this.mAddItemButton.Text = "Add Item";
this.mAddItemButton.UseVisualStyleBackColor = false;
this.mAddItemButton.Click += new System.EventHandler(this.mAddItemButton_Click);
//
// mSaveFileButton
//
this.mSaveFileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.mSaveFileButton.BackColor = System.Drawing.Color.Gray;
this.mSaveFileButton.Location = new System.Drawing.Point(109, 327);
this.mSaveFileButton.Name = "mSaveFileButton";
this.mSaveFileButton.Size = new System.Drawing.Size(102, 23);
this.mSaveFileButton.TabIndex = 22;
this.mSaveFileButton.Text = "Save lvl file";
this.mSaveFileButton.UseVisualStyleBackColor = false;
this.mSaveFileButton.Click += new System.EventHandler(this.mSaveFileButton_Click);
//
// mReplaceButton
//
this.mReplaceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.mReplaceButton.BackColor = System.Drawing.Color.Gray;
this.mReplaceButton.Location = new System.Drawing.Point(109, 288);
this.mReplaceButton.Name = "mReplaceButton";
this.mReplaceButton.Size = new System.Drawing.Size(102, 23);
this.mReplaceButton.TabIndex = 21;
this.mReplaceButton.Text = "Replace Item";
this.mReplaceButton.UseVisualStyleBackColor = false;
this.mReplaceButton.Click += new System.EventHandler(this.mReplaceButton_Click);
//
// mExtractAllButton
//
this.mExtractAllButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.mExtractAllButton.BackColor = System.Drawing.Color.Gray;
this.mExtractAllButton.Location = new System.Drawing.Point(3, 288);
this.mExtractAllButton.Name = "mExtractAllButton";
this.mExtractAllButton.Size = new System.Drawing.Size(84, 23);
this.mExtractAllButton.TabIndex = 20;
this.mExtractAllButton.Text = "Extract all";
this.mExtractAllButton.UseVisualStyleBackColor = false;
this.mExtractAllButton.Click += new System.EventHandler(this.mExtractAllButton_Click);
//
// mAssetListBox
//
this.mAssetListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.mAssetListBox.BackColor = System.Drawing.Color.Black;
this.mAssetListBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.mAssetListBox.ForeColor = System.Drawing.Color.White;
this.mAssetListBox.FormattingEnabled = true;
this.mAssetListBox.ItemHeight = 16;
this.mAssetListBox.Location = new System.Drawing.Point(3, 3);
this.mAssetListBox.Name = "mAssetListBox";
this.mAssetListBox.Size = new System.Drawing.Size(208, 196);
this.mAssetListBox.TabIndex = 19;
this.mAssetListBox.SelectedIndexChanged += new System.EventHandler(this.mAssetListBox_SelectedIndexChanged);
//
// mMainTextBox
//
this.mMainTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.mMainTextBox.BackColor = System.Drawing.Color.Black;
this.mMainTextBox.Font = new System.Drawing.Font("Courier New", 9.75F);
this.mMainTextBox.ForeColor = System.Drawing.Color.White;
this.mMainTextBox.Location = new System.Drawing.Point(3, 3);
this.mMainTextBox.Name = "mMainTextBox";
this.mMainTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.mMainTextBox.SearchString = null;
this.mMainTextBox.Size = new System.Drawing.Size(430, 358);
this.mMainTextBox.StatusControl = null;
this.mMainTextBox.TabIndex = 17;
this.mMainTextBox.Text = "";
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.Color.Transparent;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.viewToolStripMenuItem,
this.localizationMenu,
this.aboutToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(674, 24);
this.menuStrip1.TabIndex = 20;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.enterBF2ToolsDirToolStripMenuItem,
this.createNewLVLToolStripMenuItem,
this.renameItemToolStripMenuItem,
this.coreMergeFormToolStripMenuItem,
this.runUnmungeToolStripMenuItem,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// enterBF2ToolsDirToolStripMenuItem
//
this.enterBF2ToolsDirToolStripMenuItem.Name = "enterBF2ToolsDirToolStripMenuItem";
this.enterBF2ToolsDirToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.enterBF2ToolsDirToolStripMenuItem.Text = "Enter Mod Tools Dir";
this.enterBF2ToolsDirToolStripMenuItem.Click += new System.EventHandler(this.enterBF2ToolsDirToolStripMenuItem_Click);
//
// createNewLVLToolStripMenuItem
//
this.createNewLVLToolStripMenuItem.Name = "createNewLVLToolStripMenuItem";
this.createNewLVLToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.createNewLVLToolStripMenuItem.Text = "Create new LVL";
this.createNewLVLToolStripMenuItem.Click += new System.EventHandler(this.createNewLVLToolStripMenuItem_Click);
//
// renameItemToolStripMenuItem
//
this.renameItemToolStripMenuItem.Name = "renameItemToolStripMenuItem";
this.renameItemToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.renameItemToolStripMenuItem.Text = "Rename Item";
this.renameItemToolStripMenuItem.Click += new System.EventHandler(this.renameItemToolStripMenuItem_Click);
//
// coreMergeFormToolStripMenuItem
//
this.coreMergeFormToolStripMenuItem.Name = "coreMergeFormToolStripMenuItem";
this.coreMergeFormToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.coreMergeFormToolStripMenuItem.Text = "Loc Merge Form";
this.coreMergeFormToolStripMenuItem.Click += new System.EventHandler(this.locMergeFormToolStripMenuItem_Click);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.refreshLvlListBoxToolStripMenuItem,
this.sortListBoxToolStripMenuItem,
this.findToolStripMenuItem,
this.findKnownHashToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View";
//
// refreshLvlListBoxToolStripMenuItem
//
this.refreshLvlListBoxToolStripMenuItem.Name = "refreshLvlListBoxToolStripMenuItem";
this.refreshLvlListBoxToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.refreshLvlListBoxToolStripMenuItem.Text = "Refresh lvl list box";
this.refreshLvlListBoxToolStripMenuItem.Click += new System.EventHandler(this.refreshLvlListBoxToolStripMenuItem_Click);
//
// sortListBoxToolStripMenuItem
//
this.sortListBoxToolStripMenuItem.Name = "sortListBoxToolStripMenuItem";
this.sortListBoxToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.sortListBoxToolStripMenuItem.Text = "Sort List box";
this.sortListBoxToolStripMenuItem.Click += new System.EventHandler(this.sortListBoxToolStripMenuItem_Click);
//
// findToolStripMenuItem
//
this.findToolStripMenuItem.Name = "findToolStripMenuItem";
this.findToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.findToolStripMenuItem.Text = "Find Item";
this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click);
//
// findKnownHashToolStripMenuItem
//
this.findKnownHashToolStripMenuItem.Name = "findKnownHashToolStripMenuItem";
this.findKnownHashToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.findKnownHashToolStripMenuItem.Text = "Find Known Hash";
this.findKnownHashToolStripMenuItem.Click += new System.EventHandler(this.findKnownHashToolStripMenuItem_Click);
//
// localizationMenu
//
this.localizationMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.showAllStringsToolStripMenuItem1,
this.applyStringsToolStripMenuItem,
this.getToolStripMenuItem,
this.setStringMenuItem,
this.saveToFileToolStripMenuItem,
this.dumpFileToolStripMenuItem,
this.addStringToolStripMenuItem,
this.createMungedLocFileFromDataToolStripMenuItem,
this.disableStringsToolStripMenuItem,
this.addStringsifNotAlreadyPresentToolStripMenuItem});
this.localizationMenu.Enabled = false;
this.localizationMenu.Name = "localizationMenu";
this.localizationMenu.Size = new System.Drawing.Size(82, 20);
this.localizationMenu.Text = "Localization";
//
// showAllStringsToolStripMenuItem1
//
this.showAllStringsToolStripMenuItem1.Name = "showAllStringsToolStripMenuItem1";
this.showAllStringsToolStripMenuItem1.Size = new System.Drawing.Size(282, 22);
this.showAllStringsToolStripMenuItem1.Text = "Show All Strings";
this.showAllStringsToolStripMenuItem1.Click += new System.EventHandler(this.showAllStringsToolStripMenuItem_Click);
//
// applyStringsToolStripMenuItem
//
this.applyStringsToolStripMenuItem.Name = "applyStringsToolStripMenuItem";
this.applyStringsToolStripMenuItem.Size = new System.Drawing.Size(282, 22);
this.applyStringsToolStripMenuItem.Text = "Apply Strings";
this.applyStringsToolStripMenuItem.Click += new System.EventHandler(this.applyStringsToolStripMenuItem_Click);
//
// getToolStripMenuItem
//
this.getToolStripMenuItem.Name = "getToolStripMenuItem";
this.getToolStripMenuItem.Size = new System.Drawing.Size(282, 22);
this.getToolStripMenuItem.Text = "Get String";
this.getToolStripMenuItem.Click += new System.EventHandler(this.getStringToolStripMenuItem_Click);
//
// setStringMenuItem
//
this.setStringMenuItem.Name = "setStringMenuItem";
this.setStringMenuItem.Size = new System.Drawing.Size(282, 22);
this.setStringMenuItem.Text = "SetString";
this.setStringMenuItem.Click += new System.EventHandler(this.setStringMenuItem_Click);
//
// saveToFileToolStripMenuItem
//
this.saveToFileToolStripMenuItem.Name = "saveToFileToolStripMenuItem";
this.saveToFileToolStripMenuItem.Size = new System.Drawing.Size(282, 22);
this.saveToFileToolStripMenuItem.Text = "SaveToFile";
this.saveToFileToolStripMenuItem.Visible = false;
//
// dumpFileToolStripMenuItem
//
this.dumpFileToolStripMenuItem.Name = "dumpFileToolStripMenuItem";
this.dumpFileToolStripMenuItem.Size = new System.Drawing.Size(282, 22);
this.dumpFileToolStripMenuItem.Text = "Dump File";
this.dumpFileToolStripMenuItem.Visible = false;
this.dumpFileToolStripMenuItem.Click += new System.EventHandler(this.dumpFileToolStripMenuItem_Click);
//
// addStringToolStripMenuItem
//
this.addStringToolStripMenuItem.Name = "addStringToolStripMenuItem";
this.addStringToolStripMenuItem.Size = new System.Drawing.Size(282, 22);
this.addStringToolStripMenuItem.Text = "Add String";
this.addStringToolStripMenuItem.Visible = false;
this.addStringToolStripMenuItem.Click += new System.EventHandler(this.addStringToolStripMenuItem_Click);
//
// createMungedLocFileFromDataToolStripMenuItem
//
this.createMungedLocFileFromDataToolStripMenuItem.Name = "createMungedLocFileFromDataToolStripMenuItem";
this.createMungedLocFileFromDataToolStripMenuItem.Size = new System.Drawing.Size(282, 22);
this.createMungedLocFileFromDataToolStripMenuItem.Text = "Create (Munged) Loc File from text box";
this.createMungedLocFileFromDataToolStripMenuItem.Click += new System.EventHandler(this.createMungedLocFileFromDataToolStripMenuItem_Click);
//
// disableStringsToolStripMenuItem
//
this.disableStringsToolStripMenuItem.Name = "disableStringsToolStripMenuItem";
this.disableStringsToolStripMenuItem.Size = new System.Drawing.Size(282, 22);
this.disableStringsToolStripMenuItem.Text = "Disable Strings";
this.disableStringsToolStripMenuItem.Click += new System.EventHandler(this.disableStringsToolStripMenuItem_Click);
//
// addStringsifNotAlreadyPresentToolStripMenuItem
//
this.addStringsifNotAlreadyPresentToolStripMenuItem.Name = "addStringsifNotAlreadyPresentToolStripMenuItem";
this.addStringsifNotAlreadyPresentToolStripMenuItem.Size = new System.Drawing.Size(282, 22);
this.addStringsifNotAlreadyPresentToolStripMenuItem.Text = "Add Strings (if not already present)";
this.addStringsifNotAlreadyPresentToolStripMenuItem.Click += new System.EventHandler(this.addStringsifNotAlreadyPresentToolStripMenuItem_Click);
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.BackColor = System.Drawing.Color.DimGray;
this.aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aboutProgramToolStripMenuItem,
this.aboutToolStripMenuItem1});
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(52, 20);
this.aboutToolStripMenuItem.Text = "About";
//
// aboutProgramToolStripMenuItem
//
this.aboutProgramToolStripMenuItem.Name = "aboutProgramToolStripMenuItem";
this.aboutProgramToolStripMenuItem.Size = new System.Drawing.Size(182, 22);
this.aboutProgramToolStripMenuItem.Text = "About Program";
this.aboutProgramToolStripMenuItem.Click += new System.EventHandler(this.aboutProgramToolStripMenuItem_Click);
//
// aboutToolStripMenuItem1
//
this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1";
this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(182, 22);
this.aboutToolStripMenuItem1.Text = "About List Box types";
this.aboutToolStripMenuItem1.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click);
//
// mModToolsLabel
//
this.mModToolsLabel.AutoSize = true;
this.mModToolsLabel.BackColor = System.Drawing.Color.Transparent;
this.mModToolsLabel.Location = new System.Drawing.Point(183, 26);
this.mModToolsLabel.Name = "mModToolsLabel";
this.mModToolsLabel.Size = new System.Drawing.Size(70, 13);
this.mModToolsLabel.TabIndex = 21;
this.mModToolsLabel.Text = "ModToolsDir:";
this.mModToolsLabel.DoubleClick += new System.EventHandler(this.enterBF2ToolsDirToolStripMenuItem_Click);
//
// mStatusLabel
//
this.mStatusLabel.AutoSize = true;
this.mStatusLabel.ForeColor = System.Drawing.Color.Aqua;
this.mStatusLabel.Location = new System.Drawing.Point(6, 24);
this.mStatusLabel.Name = "mStatusLabel";
this.mStatusLabel.Size = new System.Drawing.Size(37, 13);
this.mStatusLabel.TabIndex = 22;
this.mStatusLabel.Text = "Status";
//
// mModToolsSelection
//
this.mModToolsSelection.BackColor = System.Drawing.Color.Gray;
this.mModToolsSelection.FormattingEnabled = true;
this.mModToolsSelection.Items.AddRange(new object[] {
"C:\\BF2_ModTools\\",
"C:\\BFBuilder\\"});
this.mModToolsSelection.Location = new System.Drawing.Point(289, 21);
this.mModToolsSelection.Name = "mModToolsSelection";
this.mModToolsSelection.Size = new System.Drawing.Size(208, 21);
this.mModToolsSelection.TabIndex = 23;
//
// runUnmungeToolStripMenuItem
//
this.runUnmungeToolStripMenuItem.Name = "runUnmungeToolStripMenuItem";
this.runUnmungeToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.runUnmungeToolStripMenuItem.Text = "Run Unmunge";
this.runUnmungeToolStripMenuItem.Click += new System.EventHandler(this.runUnmungeToolStripMenuItem_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Gray;
this.ClientSize = new System.Drawing.Size(674, 454);
this.Controls.Add(this.mModToolsSelection);
this.Controls.Add(this.mStatusLabel);
this.Controls.Add(this.mModToolsLabel);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.mBrowseLVL);
this.Controls.Add(this.mLVLFileTextBox);
this.Controls.Add(this.menuStrip1);
this.ForeColor = System.Drawing.Color.White;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "MainForm";
this.Text = "LVLTool";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button mBrowseLVL;
private System.Windows.Forms.TextBox mLVLFileTextBox;
private SearchTextBox mMainTextBox;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button mExtractAllButton;
private System.Windows.Forms.ListBox mAssetListBox;
private System.Windows.Forms.Button mReplaceButton;
private System.Windows.Forms.Button mSaveFileButton;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem enterBF2ToolsDirToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutProgramToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem refreshLvlListBoxToolStripMenuItem;
private System.Windows.Forms.Button mAddItemButton;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton decompileButton;
private System.Windows.Forms.RadioButton listingButton;
private System.Windows.Forms.RadioButton pcLuaCodeButton;
private System.Windows.Forms.RadioButton mSummaryRadioButton;
private System.Windows.Forms.Label mModToolsLabel;
private System.Windows.Forms.Label mStatusLabel;
private System.Windows.Forms.ToolStripMenuItem localizationMenu;
private System.Windows.Forms.ToolStripMenuItem showAllStringsToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem applyStringsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem getToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem setStringMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem dumpFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addStringToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem sortListBoxToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem createMungedLocFileFromDataToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem disableStringsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem createNewLVLToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addStringsifNotAlreadyPresentToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem coreMergeFormToolStripMenuItem;
private System.Windows.Forms.ComboBox mModToolsSelection;
private System.Windows.Forms.ToolStripMenuItem findKnownHashToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem renameItemToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem runUnmungeToolStripMenuItem;
}
}
| 61.748377 | 179 | 0.656335 | [
"MIT"
] | BAD-AL/LVLTool | MainForm.Designer.cs | 38,039 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using FlubuCore.Context;
using FlubuCore.Tasks;
using FlubuCore.Tasks.Process;
namespace FlubuCore.Azure.Tasks.Storage
{
public partial class AzureStorageBlobIncrementalCopyCancelTask : ExternalProcessTaskBase<AzureStorageBlobIncrementalCopyCancelTask>
{
/// <summary>
/// Aborts a pending copy_blob operation, and leaves a destination blob with zero length and full metadata.
/// </summary>
public AzureStorageBlobIncrementalCopyCancelTask(string containerName = null , string copyId = null , string name = null)
{
WithArguments("az storage blob incremental-copy cancel");
WithArguments("--container-name");
if (!string.IsNullOrEmpty(containerName))
{
WithArguments(containerName);
}
WithArguments("--copy-id");
if (!string.IsNullOrEmpty(copyId))
{
WithArguments(copyId);
}
WithArguments("--name");
if (!string.IsNullOrEmpty(name))
{
WithArguments(name);
}
}
protected override string Description { get; set; }
/// <summary>
/// The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.
/// </summary>
public AzureStorageBlobIncrementalCopyCancelTask AuthMode(string authMode = null)
{
WithArguments("--auth-mode");
if (!string.IsNullOrEmpty(authMode))
{
WithArguments(authMode);
}
return this;
}
/// <summary>
/// Required if the destination blob has an active infinite lease.
/// </summary>
public AzureStorageBlobIncrementalCopyCancelTask LeaseId(string leaseId = null)
{
WithArguments("--lease-id");
if (!string.IsNullOrEmpty(leaseId))
{
WithArguments(leaseId);
}
return this;
}
/// <summary>
/// Request timeout in seconds. Applies to each call to the service.
/// </summary>
public AzureStorageBlobIncrementalCopyCancelTask Timeout(string timeout = null)
{
WithArguments("--timeout");
if (!string.IsNullOrEmpty(timeout))
{
WithArguments(timeout);
}
return this;
}
/// <summary>
/// Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.
/// </summary>
public AzureStorageBlobIncrementalCopyCancelTask AccountKey(string accountKey = null)
{
WithArguments("--account-key");
if (!string.IsNullOrEmpty(accountKey))
{
WithArguments(accountKey);
}
return this;
}
/// <summary>
/// Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.
/// </summary>
public AzureStorageBlobIncrementalCopyCancelTask AccountName(string accountName = null)
{
WithArguments("--account-name");
if (!string.IsNullOrEmpty(accountName))
{
WithArguments(accountName);
}
return this;
}
/// <summary>
/// Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.
/// </summary>
public AzureStorageBlobIncrementalCopyCancelTask ConnectionString(string connectionString = null)
{
WithArguments("--connection-string");
if (!string.IsNullOrEmpty(connectionString))
{
WithArguments(connectionString);
}
return this;
}
/// <summary>
/// A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.
/// </summary>
public AzureStorageBlobIncrementalCopyCancelTask SasToken(string sasToken = null)
{
WithArguments("--sas-token");
if (!string.IsNullOrEmpty(sasToken))
{
WithArguments(sasToken);
}
return this;
}
}
}
| 34.695035 | 356 | 0.596893 | [
"MIT"
] | flubu-core/FlubuCore.Azure | FlubuCore.Azure/Tasks/Storage/AzureStorageBlobIncrementalCopyCancelTask.cs | 4,892 | C# |
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
using WPFUI.Theme;
namespace WPFUI.Syntax
{
// TODO: This class is work in progress.
/// <summary>
/// Formats a string of code into <see cref="System.Windows.Controls.TextBox"/> control.
/// <para>Implementation and regex patterns inspired by <see href="https://github.com/antoniandre/simple-syntax-highlighter"/>.</para>
/// </summary>
internal static class Highlighter
{
private const string EndlinePattern = /* language=regex */ "(\n)";
private const string TabPattern = /* language=regex */ "(\t)";
private const string QuotePattern = /* language=regex */ "(\"(?:\\\"|[^\"])*\")|('(?:\\'|[^'])*')";
private const string CommentPattern = /* language=regex */ @"(\/\/.*?(?:\n|$)|\/\*.*?\*\/)";
private const string TagPattern = /* language=regex */ @"(<\/?)([a-zA-Z\-:]+)(.*?)(\/?>)";
private const string EntityPattern = /* language=regex */ @"(&[a-zA-Z0-9#]+;)";
private const string PunctuationPattern = /* language=regex */
@"(!==?|(?:[[\\] (){}.:;,+\\-?=!]|<|>)+|&&|\\|\\|)";
private const string NumberPattern = /* language=regex */ @"(-? (?:\.\d+|\d+(?:\.\d+)?))";
private const string BooleanPattern = /* language=regex */ "\b(true|false)\b";
private const string AttributePattern = /* language=regex */ "(\\s*)([a-zA-Z\\d\\-:]+)=(\" | ')(.*?)\\3";
public static TextBlock Format(object code)
{
return Format(code as string ?? String.Empty);
}
public static TextBlock Format(string code, SyntaxLanguage language = SyntaxLanguage.Autodetect)
{
TextBlock returnText = new TextBlock();
Regex rgx = new(GetPattern(language, code));
Group codeMatched;
bool lightTheme = IsLightTheme();
foreach (Match match in rgx.Matches(code))
{
foreach (object group in match.Groups)
{
// Remove whole matches
if (group is Match) continue;
// Cast to group
codeMatched = (Group)group;
// Remove empty groups
if (String.IsNullOrEmpty(codeMatched.Value)) continue;
if (codeMatched.Value.Contains("\t"))
{
returnText.Inlines.Add(Line(" ", Brushes.Transparent));
}
else if (codeMatched.Value.Contains("/*") || codeMatched.Value.Contains("//"))
{
returnText.Inlines.Add(Line(codeMatched.Value, Brushes.Orange));
}
else if (codeMatched.Value.Contains("<") || codeMatched.Value.Contains(">"))
{
returnText.Inlines.Add(Line(codeMatched.Value,
lightTheme ? Brushes.DarkCyan : Brushes.CornflowerBlue));
}
else if (codeMatched.Value.Contains("\""))
{
string[] attributeArray = codeMatched.Value.Split('"');
attributeArray = attributeArray.Where(x => !string.IsNullOrEmpty(x.Trim())).ToArray();
if (attributeArray.Length % 2 == 0)
{
for (int i = 0; i < attributeArray.Length; i += 2)
{
returnText.Inlines.Add(Line(attributeArray[i],
lightTheme ? Brushes.DarkSlateGray : Brushes.WhiteSmoke));
returnText.Inlines.Add(Line("\"",
lightTheme ? Brushes.DarkCyan : Brushes.CornflowerBlue));
returnText.Inlines.Add(Line(attributeArray[i + 1], Brushes.Coral));
returnText.Inlines.Add(Line("\"",
lightTheme ? Brushes.DarkCyan : Brushes.CornflowerBlue));
}
}
else
{
returnText.Inlines.Add(Line(codeMatched.Value,
lightTheme ? Brushes.DarkSlateGray : Brushes.WhiteSmoke));
}
}
else if (codeMatched.Value.Contains("'"))
{
string[] attributeArray = codeMatched.Value.Split('\'');
attributeArray = attributeArray.Where(x => !string.IsNullOrEmpty(x.Trim())).ToArray();
if (attributeArray.Length % 2 == 0)
{
for (int i = 0; i < attributeArray.Length; i += 2)
{
returnText.Inlines.Add(Line(attributeArray[i],
lightTheme ? Brushes.DarkSlateGray : Brushes.WhiteSmoke));
returnText.Inlines.Add(
Line("'", lightTheme ? Brushes.DarkCyan : Brushes.CornflowerBlue));
returnText.Inlines.Add(Line(attributeArray[i + 1], Brushes.Coral));
returnText.Inlines.Add(
Line("'", lightTheme ? Brushes.DarkCyan : Brushes.CornflowerBlue));
}
}
else
{
returnText.Inlines.Add(Line(codeMatched.Value,
lightTheme ? Brushes.DarkSlateGray : Brushes.WhiteSmoke));
}
}
else
{
returnText.Inlines.Add(Line(codeMatched.Value,
lightTheme ? Brushes.CornflowerBlue : Brushes.Aqua));
}
}
}
return returnText;
}
public static string Clean(string code)
{
code = code.Replace(@"\n", "\n");
code = code.Replace(@"\t", "\t");
code = code.Replace("<", "<");
code = code.Replace(">", ">");
code = code.Replace("&", "&");
code = code.Replace(""", "\"");
code = code.Replace("'", "'");
return code;
}
private static Run Line(string line, SolidColorBrush brush)
{
return new Run(line) { Foreground = brush };
}
private static bool IsLightTheme()
{
Style theme = Manager.GetCurrentTheme();
return !(theme == Style.Dark || theme == Style.Glow || theme == Style.CapturedMotion);
}
private static string GetPattern(SyntaxLanguage language, string code = "")
{
string pattern = "";
// TODO: Autodected
if (language == SyntaxLanguage.Autodetect)
language = SyntaxLanguage.XAML;
switch (language)
{
case SyntaxLanguage.CSHARP:
pattern += EndlinePattern;
pattern += "|" + TabPattern;
pattern += "|" + QuotePattern;
pattern += "|" + CommentPattern;
pattern += "|" + EntityPattern;
pattern += "|" + TagPattern;
break;
case SyntaxLanguage.XAML:
pattern += EndlinePattern;
pattern += "|" + TabPattern;
pattern += "|" + QuotePattern;
pattern += "|" + CommentPattern;
pattern += "|" + EntityPattern;
pattern += "|" + TagPattern;
break;
}
return pattern;
}
}
} | 42.005 | 138 | 0.467206 | [
"MIT"
] | MajorXAML/wpfui | WPFUI/Syntax/Highlighter.cs | 8,403 | C# |
// <copyright company="Aspose Pty Ltd">
// Copyright (C) 2011-2021 GroupDocs. All Rights Reserved.
// </copyright>
namespace GroupDocs.Metadata.Examples.CSharp.AdvancedUsage.ManagingMetadataForSpecificFormats.Document.WordProcessing
{
using System;
using Formats.Document;
/// <summary>
/// This example shows how to detect the exact type of a loaded document and extract some additional file format information.
/// </summary>
public static class WordProcessingReadFileFormatProperties
{
public static void Run()
{
using (Metadata metadata = new Metadata(Constants.InputDoc))
{
var root = metadata.GetRootPackage<WordProcessingRootPackage>();
Console.WriteLine(root.FileType.FileFormat);
Console.WriteLine(root.FileType.WordProcessingFormat);
Console.WriteLine(root.FileType.MimeType);
Console.WriteLine(root.FileType.Extension);
}
}
}
}
| 35.068966 | 129 | 0.660767 | [
"MIT"
] | groupdocs-metadata/GroupDocs.Metadata-for-.NET | Examples/GroupDocs.Metadata.Examples.CSharp/AdvancedUsage/ManagingMetadataForSpecificFormats/Document/WordProcessing/WordProcessingReadFileFormatProperties.cs | 1,019 | C# |
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using GoldBadgeConsoleChallengeClasses;
using System.Collections.Generic;
namespace GoldBadgeConsoleChallengeTests
{
[TestClass]
public class IngredientTest
{
Ingredient avocado = new Ingredient("Avocado", 0.75m, true, true, true, true, 12, IngredientCategory.Vegetable);
IngredientCRUD ingredientTester = new IngredientCRUD();
[TestMethod]
public void IngredientAddTest()
{
// Arrange
int beginningCount = ingredientTester.GetIngredientsList().Count;
// Act
ingredientTester.AddToIngredientsList(avocado);
// Assert
int endingCount = ingredientTester.GetIngredientsList().Count;
Assert.IsTrue(endingCount > beginningCount, "Add was not successful.");
}
[TestMethod]
public void IngredientReadTest()
{
// No arrangement necessary
// Act
ingredientTester.AddToIngredientsList(avocado);
// Assert
Assert.IsNotNull(ingredientTester.GetIngredientsList(), "Read was not successful.");
}
[TestMethod]
public void IngredientEditTest()
{
// Arrange
var chicken = new Ingredient("Chicken", 4.00m, false, true, true, false, 20, IngredientCategory.Protein);
// Act
ingredientTester.AddToIngredientsList(avocado);
bool wasEdited = ingredientTester.EditIngredientInList("Avocado", chicken);
// Assert
Assert.IsTrue(wasEdited, "Edit was not successful.");
}
[TestMethod]
public void IngredientDeleteTest()
{
// Arrange
ingredientTester.AddToIngredientsList(avocado);
// Act
bool wasDeleted = ingredientTester.RemoveIngredientFromList("Avocado");
// Assert
Assert.IsTrue(wasDeleted, "Delete was not successful.");
}
}
}
| 29.826087 | 120 | 0.609815 | [
"Unlicense",
"MIT"
] | johncaseymcd/GoldBadgeConsoleChallenges | GoldBadgeConsoleAppTests/KomodoCafe_IngredientTests.cs | 2,060 | C# |
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using Shared.Everywhere;
[assembly: AssemblyTitle(AssemblyInfoContainer.AssemblyName)]
[assembly: AssemblyDescription("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyCompany(AssemblyInfoContainer.AssemblyCompany)]
[assembly: AssemblyProduct(AssemblyInfoContainer.AssemblyProduct)]
[assembly: AssemblyCopyright(AssemblyInfoContainer.AssemblyCopyright)]
[assembly: AssemblyVersion(AssemblyInfoContainer.AssemblyVersion)] | 46.846154 | 97 | 0.860427 | [
"MIT"
] | alxcp/ABCat | ABCat/Properties/AssemblyInfo.cs | 611 | C# |
/*
* Copyright (C) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if (UNITY_ANDROID || (UNITY_IPHONE && !NO_GPGS))
using System;
using GooglePlayGames.Native.PInvoke;
using System.Runtime.InteropServices;
using GooglePlayGames.OurUtils;
using System.Collections.Generic;
using GooglePlayGames.Native.Cwrapper;
using C = GooglePlayGames.Native.Cwrapper.RealTimeRoomConfig;
using Types = GooglePlayGames.Native.Cwrapper.Types;
using Status = GooglePlayGames.Native.Cwrapper.CommonErrorStatus;
namespace GooglePlayGames.Native.PInvoke {
internal class RealtimeRoomConfig : BaseReferenceHolder {
internal RealtimeRoomConfig(IntPtr selfPointer) : base(selfPointer) {
}
protected override void CallDispose(HandleRef selfPointer) {
C.RealTimeRoomConfig_Dispose(selfPointer);
}
internal static RealtimeRoomConfig FromPointer(IntPtr selfPointer) {
if (selfPointer.Equals(IntPtr.Zero)) {
return null;
}
return new RealtimeRoomConfig(selfPointer);
}
}
}
#endif
| 31.836735 | 75 | 0.751282 | [
"MIT"
] | Kaktus606/Fifteen | Assets/GooglePlayGames/Platforms/Native/PInvoke/RealtimeRoomConfig.cs | 1,560 | C# |
// ------------------------------------------------------------------------------
// <auto-generated>
// Generated by Xsd2Code. Version 3.4.0.18239 Microsoft Reciprocal License (Ms-RL)
// <NameSpace>Dms.Ambulance.V2100</NameSpace><Collection>Array</Collection><codeType>CSharp</codeType><EnableDataBinding>False</EnableDataBinding><EnableLazyLoading>False</EnableLazyLoading><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><VirtualProp>False</VirtualProp><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net35</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><OrderXMLAttrib>False</OrderXMLAttrib><EnableEncoding>False</EnableEncoding><AutomaticProperties>False</AutomaticProperties><GenerateShouldSerialize>False</GenerateShouldSerialize><DisableDebug>False</DisableDebug><PropNameSpecified>Default</PropNameSpecified><Encoder>UTF8</Encoder><CustomUsings></CustomUsings><ExcludeIncludedTypes>True</ExcludeIncludedTypes><EnableInitializeFields>False</EnableInitializeFields>
// </auto-generated>
// ------------------------------------------------------------------------------
namespace Dms.Ambulance.V2100 {
using System;
using System.Diagnostics;
using System.Xml.Serialization;
using System.Collections;
using System.Xml.Schema;
using System.ComponentModel;
using System.IO;
using System.Text;
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.4.0.18239")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:hl7-org:v3")]
public partial class COCD_TP146224GB01ObservationMediaTemplateId : II {
private static System.Xml.Serialization.XmlSerializer serializer;
private static System.Xml.Serialization.XmlSerializer Serializer {
get {
if ((serializer == null)) {
serializer = new System.Xml.Serialization.XmlSerializer(typeof(COCD_TP146224GB01ObservationMediaTemplateId));
}
return serializer;
}
}
#region Serialize/Deserialize
/// <summary>
/// Serializes current COCD_TP146224GB01ObservationMediaTemplateId object into an XML document
/// </summary>
/// <returns>string XML value</returns>
public virtual string Serialize() {
System.IO.StreamReader streamReader = null;
System.IO.MemoryStream memoryStream = null;
try {
memoryStream = new System.IO.MemoryStream();
Serializer.Serialize(memoryStream, this);
memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
streamReader = new System.IO.StreamReader(memoryStream);
return streamReader.ReadToEnd();
}
finally {
if ((streamReader != null)) {
streamReader.Dispose();
}
if ((memoryStream != null)) {
memoryStream.Dispose();
}
}
}
/// <summary>
/// Deserializes workflow markup into an COCD_TP146224GB01ObservationMediaTemplateId object
/// </summary>
/// <param name="xml">string workflow markup to deserialize</param>
/// <param name="obj">Output COCD_TP146224GB01ObservationMediaTemplateId object</param>
/// <param name="exception">output Exception value if deserialize failed</param>
/// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
public static bool Deserialize(string xml, out COCD_TP146224GB01ObservationMediaTemplateId obj, out System.Exception exception) {
exception = null;
obj = default(COCD_TP146224GB01ObservationMediaTemplateId);
try {
obj = Deserialize(xml);
return true;
}
catch (System.Exception ex) {
exception = ex;
return false;
}
}
public static bool Deserialize(string xml, out COCD_TP146224GB01ObservationMediaTemplateId obj) {
System.Exception exception = null;
return Deserialize(xml, out obj, out exception);
}
public static COCD_TP146224GB01ObservationMediaTemplateId Deserialize(string xml) {
System.IO.StringReader stringReader = null;
try {
stringReader = new System.IO.StringReader(xml);
return ((COCD_TP146224GB01ObservationMediaTemplateId)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader))));
}
finally {
if ((stringReader != null)) {
stringReader.Dispose();
}
}
}
/// <summary>
/// Serializes current COCD_TP146224GB01ObservationMediaTemplateId object into file
/// </summary>
/// <param name="fileName">full path of outupt xml file</param>
/// <param name="exception">output Exception value if failed</param>
/// <returns>true if can serialize and save into file; otherwise, false</returns>
public virtual bool SaveToFile(string fileName, out System.Exception exception) {
exception = null;
try {
SaveToFile(fileName);
return true;
}
catch (System.Exception e) {
exception = e;
return false;
}
}
public virtual void SaveToFile(string fileName) {
System.IO.StreamWriter streamWriter = null;
try {
string xmlString = Serialize();
System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName);
streamWriter = xmlFile.CreateText();
streamWriter.WriteLine(xmlString);
streamWriter.Close();
}
finally {
if ((streamWriter != null)) {
streamWriter.Dispose();
}
}
}
/// <summary>
/// Deserializes xml markup from file into an COCD_TP146224GB01ObservationMediaTemplateId object
/// </summary>
/// <param name="fileName">string xml file to load and deserialize</param>
/// <param name="obj">Output COCD_TP146224GB01ObservationMediaTemplateId object</param>
/// <param name="exception">output Exception value if deserialize failed</param>
/// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
public static bool LoadFromFile(string fileName, out COCD_TP146224GB01ObservationMediaTemplateId obj, out System.Exception exception) {
exception = null;
obj = default(COCD_TP146224GB01ObservationMediaTemplateId);
try {
obj = LoadFromFile(fileName);
return true;
}
catch (System.Exception ex) {
exception = ex;
return false;
}
}
public static bool LoadFromFile(string fileName, out COCD_TP146224GB01ObservationMediaTemplateId obj) {
System.Exception exception = null;
return LoadFromFile(fileName, out obj, out exception);
}
public static COCD_TP146224GB01ObservationMediaTemplateId LoadFromFile(string fileName) {
System.IO.FileStream file = null;
System.IO.StreamReader sr = null;
try {
file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read);
sr = new System.IO.StreamReader(file);
string xmlString = sr.ReadToEnd();
sr.Close();
file.Close();
return Deserialize(xmlString);
}
finally {
if ((file != null)) {
file.Dispose();
}
if ((sr != null)) {
sr.Dispose();
}
}
}
#endregion
#region Clone method
/// <summary>
/// Create a clone of this COCD_TP146224GB01ObservationMediaTemplateId object
/// </summary>
public virtual COCD_TP146224GB01ObservationMediaTemplateId Clone() {
return ((COCD_TP146224GB01ObservationMediaTemplateId)(this.MemberwiseClone()));
}
#endregion
}
}
| 48.650794 | 1,368 | 0.610875 | [
"MIT"
] | Kusnaditjung/MimDms | src/Dms.Ambulance.V2100/Generated/COCD_TP146224GB01ObservationMediaTemplateId.cs | 9,195 | C# |
using System.Collections.Generic;
namespace Disqord
{
/// <summary>
/// Represents a row component which is a parent to multiple child components.
/// </summary>
public interface IRowComponent : IComponent, IEnumerable<IComponent>
{
/// <summary>
/// Gets the child components of this row component.
/// </summary>
IReadOnlyList<IComponent> Components { get; }
}
}
| 27.875 | 87 | 0.605381 | [
"MIT"
] | Neuheit/Diqnod | src/Disqord.Core/Entities/Core/Interactions/Components/IRowComponent.cs | 448 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using ESnail.Utilities;
using ESnail.Device;
namespace ESnail.Device.Adapters.USB
{
//! single endpoint usb device adapter
public abstract class SingleEndPointUSBDeviceAdapter : SingleDeviceAdapter
{
protected System.String m_strUSBDevicePathName = null;
//! override adapter type property
public override string Type
{
get { return "Single EndPoint USB ESnail.Device Adapter"; }
}
//! constructor
public SingleEndPointUSBDeviceAdapter(SafeID tID, IDevice DeviceInterface)
: base(tID, DeviceInterface)
{
}
//! settings for single endpoint usb device
public override String Settings
{
get { return m_strUSBDevicePathName; }
set
{
if (!Open)
{
//! setting could only be changed when device was disconnected.
m_strUSBDevicePathName = value;
WriteLogLine("Change Setting succeeded.");
}
else
{
WriteLogLine("Change Setting failed. Setting could only be changed when adapter is closed.");
}
}
}
//! open adapter
public override Boolean Open
{
set
{
if (value == true)
{
if (!Open)
{
lock(m_Signal)
{
try
{
m_Device.OpenDevice(m_strUSBDevicePathName);
}
catch (Exception) { }
}
if (Open)
{
WriteLogLine("Open adapter succeeded.");
//! raising event
OnDeviceOpened();
}
else
{
WriteLogLine("Open adapter failed.");
}
}
}
else
{
if (Open)
{
this.IsWorking = false;
lock (m_Signal)
{
m_Device.CloseDevice();
}
WriteLogLine("Adapter closed.");
//! raising event
OnDeviceClosed();
}
}
}
}
}
} | 29.904255 | 113 | 0.387407 | [
"Apache-2.0"
] | GorgonMeducer/Embedded-Development-Gadgets | ESDevice/Adapters/SingleDeviceAdapter/SingleEndPointUSBDevice.cs | 2,813 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Collections.Concurrent;
using System.Reflection;
namespace SqlBulkHelpers
{
public class SqlBulkHelpersObjectMapper
{
public DataTable ConvertEntitiesToDataTable<T>(IEnumerable<T> entityList, SqlBulkHelpersColumnDefinition identityColumnDefinition)
{
//Get the name of hte Identity Column
//NOTE: BBernard - We take in the strongly typed class (immutable) to ensure that we have validated Parameter vs raw string!
//var identityColumnName = identityColumnDefinition.ColumnName;
//NOTE: We Map all Properties to an anonymous type with Index, Name, and base PropInfo here for easier logic below,
// and we ALWAYS convert to a List<> so that we always preserve the critical order of the PropertyInfo items!
// to simplify all following code.
//NOTE: The helper class provides internal Lazy type caching for better performance once a type has been loaded.
var propertyDefs = SqlBulkHelpersObjectReflectionFactory.GetPropertyDefinitions<T>(identityColumnDefinition);
DataTable dataTable = new DataTable();
dataTable.Columns.AddRange(propertyDefs.Select(pi => new DataColumn
{
ColumnName = pi.Name,
DataType = Nullable.GetUnderlyingType(pi.PropInfo.PropertyType) ?? pi.PropInfo.PropertyType,
//We Always allow Null to make below logic easier, and it's the Responsibility of the Model to ensure values are Not Null vs Nullable.
AllowDBNull = true //Nullable.GetUnderlyingType(pi.PropertyType) == null ? false : true
}).ToArray());
//BBernard - We ALWAYS Add the internal RowNumber reference so that we can exactly correlate Identity values from the Server
// back to original records that we passed!
//NOTE: THIS IS CRITICAL because SqlBulkCopy and Sql Server OUTPUT clause do not preserve Order; e.g. it may change based
// on execution plan (indexes/no indexes, etc.).
dataTable.Columns.Add(new DataColumn()
{
ColumnName = SqlBulkHelpersConstants.ROWNUMBER_COLUMN_NAME,
DataType = typeof(int),
AllowDBNull = true
});
int rowCounter = 1;
int identityIdFakeCounter = -1;
foreach (T entity in entityList)
{
var rowValues = propertyDefs.Select(p => {
var value = p.PropInfo.GetValue(entity);
//Handle special cases to ensure that Identity values are mapped to unique invalid values.
if (p.IsIdentityProperty && (int)value <= 0)
{
//Create a Unique but Invalid Fake Identity Id (e.g. negative number)!
value = identityIdFakeCounter--;
}
return value;
}).ToArray();
//Add the Values (must be critically in the same order as the PropertyInfos List) as a new Row!
var newRow = dataTable.Rows.Add(rowValues);
//Always set the unique Row Number identifier
newRow[SqlBulkHelpersConstants.ROWNUMBER_COLUMN_NAME] = rowCounter++;
}
return dataTable;
}
}
}
| 47.256757 | 150 | 0.61853 | [
"MIT"
] | cajuncoding/SqlBulkHelpers | NetStandard.SqlBulkHelpers/SqlBulkHelpers/QueryProcessing/SqlBulkHelpersObjectMapper.cs | 3,499 | C# |
using J2N.Text;
using YAF.Lucene.Net.Support;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using JCG = J2N.Collections.Generic;
namespace YAF.Lucene.Net.Index
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <summary>
/// Merges segments of approximately equal size, subject to
/// an allowed number of segments per tier. This is similar
/// to <see cref="LogByteSizeMergePolicy"/>, except this merge
/// policy is able to merge non-adjacent segment, and
/// separates how many segments are merged at once (<see cref="MaxMergeAtOnce"/>)
/// from how many segments are allowed
/// per tier (<see cref="SegmentsPerTier"/>). This merge
/// policy also does not over-merge (i.e. cascade merges).
///
/// <para/>For normal merging, this policy first computes a
/// "budget" of how many segments are allowed to be in the
/// index. If the index is over-budget, then the policy
/// sorts segments by decreasing size (pro-rating by percent
/// deletes), and then finds the least-cost merge. Merge
/// cost is measured by a combination of the "skew" of the
/// merge (size of largest segment divided by smallest segment),
/// total merge size and percent deletes reclaimed,
/// so that merges with lower skew, smaller size
/// and those reclaiming more deletes, are
/// favored.
///
/// <para/>If a merge will produce a segment that's larger than
/// <see cref="MaxMergedSegmentMB"/>, then the policy will
/// merge fewer segments (down to 1 at once, if that one has
/// deletions) to keep the segment size under budget.
///
/// <para/><b>NOTE</b>: This policy freely merges non-adjacent
/// segments; if this is a problem, use <see cref="LogMergePolicy"/>.
///
/// <para/><b>NOTE</b>: This policy always merges by byte size
/// of the segments, always pro-rates by percent deletes,
/// and does not apply any maximum segment size during
/// forceMerge (unlike <see cref="LogByteSizeMergePolicy"/>).
/// <para/>
/// @lucene.experimental
/// </summary>
// TODO
// - we could try to take into account whether a large
// merge is already running (under CMS) and then bias
// ourselves towards picking smaller merges if so (or,
// maybe CMS should do so)
public class TieredMergePolicy : MergePolicy
{
/// <summary>
/// Default noCFSRatio. If a merge's size is >= 10% of
/// the index, then we disable compound file for it.
/// </summary>
/// <seealso cref="MergePolicy.NoCFSRatio"/>
public new static readonly double DEFAULT_NO_CFS_RATIO = 0.1;
private int maxMergeAtOnce = 10;
private long maxMergedSegmentBytes = 5 * 1024 * 1024 * 1024L;
private int maxMergeAtOnceExplicit = 30;
private long floorSegmentBytes = 2 * 1024 * 1024L;
private double segsPerTier = 10.0;
private double forceMergeDeletesPctAllowed = 10.0;
private double reclaimDeletesWeight = 2.0;
/// <summary>
/// Sole constructor, setting all settings to their
/// defaults.
/// </summary>
public TieredMergePolicy()
: base(DEFAULT_NO_CFS_RATIO, MergePolicy.DEFAULT_MAX_CFS_SEGMENT_SIZE)
{
}
/// <summary>
/// Gets or sets maximum number of segments to be merged at a time
/// during "normal" merging. For explicit merging (eg,
/// <see cref="IndexWriter.ForceMerge(int)"/> or
/// <see cref="IndexWriter.ForceMergeDeletes()"/> was called), see
/// <see cref="MaxMergeAtOnceExplicit"/>. Default is 10.
/// </summary>
public virtual int MaxMergeAtOnce
{
get => maxMergeAtOnce;
set
{
if (value < 2)
{
throw new ArgumentOutOfRangeException(nameof(MaxMergeAtOnce), "maxMergeAtOnce must be > 1 (got " + value + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
}
maxMergeAtOnce = value;
}
}
// TODO: should addIndexes do explicit merging, too? And,
// if user calls IW.maybeMerge "explicitly"
/// <summary>
/// Gets or sets maximum number of segments to be merged at a time,
/// during <see cref="IndexWriter.ForceMerge(int)"/> or
/// <see cref="IndexWriter.ForceMergeDeletes()"/>. Default is 30.
/// </summary>
public virtual int MaxMergeAtOnceExplicit
{
get => maxMergeAtOnceExplicit;
set
{
if (value < 2)
{
throw new ArgumentOutOfRangeException(nameof(MaxMergeAtOnceExplicit), "maxMergeAtOnceExplicit must be > 1 (got " + value + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
}
maxMergeAtOnceExplicit = value;
}
}
/// <summary>
/// Gets or sets maximum sized segment to produce during
/// normal merging. This setting is approximate: the
/// estimate of the merged segment size is made by summing
/// sizes of to-be-merged segments (compensating for
/// percent deleted docs). Default is 5 GB.
/// </summary>
public virtual double MaxMergedSegmentMB
{
get => maxMergedSegmentBytes / 1024 / 1024.0;
set
{
if (value < 0.0)
{
throw new ArgumentOutOfRangeException(nameof(MaxMergedSegmentMB), "maxMergedSegmentMB must be >=0 (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
}
value *= 1024 * 1024;
maxMergedSegmentBytes = (value > long.MaxValue) ? long.MaxValue : (long)value;
}
}
/// <summary>
/// Controls how aggressively merges that reclaim more
/// deletions are favored. Higher values will more
/// aggressively target merges that reclaim deletions, but
/// be careful not to go so high that way too much merging
/// takes place; a value of 3.0 is probably nearly too
/// high. A value of 0.0 means deletions don't impact
/// merge selection.
/// </summary>
public virtual double ReclaimDeletesWeight
{
get => reclaimDeletesWeight;
set
{
if (value < 0.0)
{
throw new ArgumentOutOfRangeException(nameof(ReclaimDeletesWeight), "reclaimDeletesWeight must be >= 0.0 (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
}
reclaimDeletesWeight = value;
}
}
/// <summary>
/// Segments smaller than this are "rounded up" to this
/// size, ie treated as equal (floor) size for merge
/// selection. this is to prevent frequent flushing of
/// tiny segments from allowing a long tail in the index.
/// Default is 2 MB.
/// </summary>
public virtual double FloorSegmentMB
{
get => floorSegmentBytes / (1024 * 1024.0);
set
{
if (value <= 0.0)
{
throw new ArgumentOutOfRangeException(nameof(FloorSegmentMB), "floorSegmentMB must be >= 0.0 (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
}
value *= 1024 * 1024;
floorSegmentBytes = (value > long.MaxValue) ? long.MaxValue : (long)value;
}
}
/// <summary>
/// When forceMergeDeletes is called, we only merge away a
/// segment if its delete percentage is over this
/// threshold. Default is 10%.
/// </summary>
public virtual double ForceMergeDeletesPctAllowed
{
get => forceMergeDeletesPctAllowed;
set
{
if (value < 0.0 || value > 100.0)
{
throw new ArgumentOutOfRangeException(nameof(ForceMergeDeletesPctAllowed), "forceMergeDeletesPctAllowed must be between 0.0 and 100.0 inclusive (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
}
forceMergeDeletesPctAllowed = value;
}
}
/// <summary>
/// Gets or sets the allowed number of segments per tier. Smaller
/// values mean more merging but fewer segments.
///
/// <para/><b>NOTE</b>: this value should be >= the
/// <see cref="MaxMergeAtOnce"/> otherwise you'll force too much
/// merging to occur.
///
/// <para/>Default is 10.0.
/// </summary>
public virtual double SegmentsPerTier
{
get => segsPerTier;
set
{
if (value < 2.0)
{
throw new ArgumentOutOfRangeException(nameof(SegmentsPerTier), "segmentsPerTier must be >= 2.0 (got " + value.ToString("0.0") + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
}
segsPerTier = value;
}
}
private class SegmentByteSizeDescending : IComparer<SegmentCommitInfo>
{
private readonly TieredMergePolicy outerInstance;
public SegmentByteSizeDescending(TieredMergePolicy outerInstance)
{
this.outerInstance = outerInstance;
}
public virtual int Compare(SegmentCommitInfo o1, SegmentCommitInfo o2)
{
try
{
long sz1 = outerInstance.Size(o1);
long sz2 = outerInstance.Size(o2);
if (sz1 > sz2)
{
return -1;
}
else if (sz2 > sz1)
{
return 1;
}
else
{
return o1.Info.Name.CompareToOrdinal(o2.Info.Name);
}
}
catch (Exception ioe) when (ioe.IsIOException())
{
throw RuntimeException.Create(ioe);
}
}
}
/// <summary>
/// Holds score and explanation for a single candidate
/// merge.
/// </summary>
protected abstract class MergeScore
{
/// <summary>
/// Sole constructor. (For invocation by subclass
/// constructors, typically implicit.)
/// </summary>
protected MergeScore()
{
}
/// <summary>
/// Returns the score for this merge candidate; lower
/// scores are better.
/// </summary>
public abstract double Score { get; }
/// <summary>
/// Human readable explanation of how the merge got this
/// score.
/// </summary>
public abstract string Explanation { get; }
}
public override MergeSpecification FindMerges(MergeTrigger mergeTrigger, SegmentInfos infos)
{
if (Verbose())
{
Message("findMerges: " + infos.Count + " segments");
}
if (infos.Count == 0)
{
return null;
}
ICollection<SegmentCommitInfo> merging = m_writer.Get().MergingSegments;
ICollection<SegmentCommitInfo> toBeMerged = new JCG.HashSet<SegmentCommitInfo>();
JCG.List<SegmentCommitInfo> infosSorted = new JCG.List<SegmentCommitInfo>(infos.AsList());
infosSorted.Sort(new SegmentByteSizeDescending(this));
// Compute total index bytes & print details about the index
long totIndexBytes = 0;
long minSegmentBytes = long.MaxValue;
foreach (SegmentCommitInfo info in infosSorted)
{
long segBytes = Size(info);
if (Verbose())
{
string extra = merging.Contains(info) ? " [merging]" : "";
if (segBytes >= maxMergedSegmentBytes / 2.0)
{
extra += " [skip: too large]";
}
else if (segBytes < floorSegmentBytes)
{
extra += " [floored]";
}
Message(" seg=" + m_writer.Get().SegString(info) + " size=" + string.Format("{0:0.000}", segBytes / 1024 / 1024.0) + " MB" + extra);
}
minSegmentBytes = Math.Min(segBytes, minSegmentBytes);
// Accum total byte size
totIndexBytes += segBytes;
}
// If we have too-large segments, grace them out
// of the maxSegmentCount:
int tooBigCount = 0;
while (tooBigCount < infosSorted.Count && Size(infosSorted[tooBigCount]) >= maxMergedSegmentBytes / 2.0)
{
totIndexBytes -= Size(infosSorted[tooBigCount]);
tooBigCount++;
}
minSegmentBytes = FloorSize(minSegmentBytes);
// Compute max allowed segs in the index
long levelSize = minSegmentBytes;
long bytesLeft = totIndexBytes;
double allowedSegCount = 0;
while (true)
{
double segCountLevel = bytesLeft / (double)levelSize;
if (segCountLevel < segsPerTier)
{
allowedSegCount += Math.Ceiling(segCountLevel);
break;
}
allowedSegCount += segsPerTier;
bytesLeft -= (long)(segsPerTier * levelSize);
levelSize *= maxMergeAtOnce;
}
int allowedSegCountInt = (int)allowedSegCount;
MergeSpecification spec = null;
// Cycle to possibly select more than one merge:
while (true)
{
long mergingBytes = 0;
// Gather eligible segments for merging, ie segments
// not already being merged and not already picked (by
// prior iteration of this loop) for merging:
IList<SegmentCommitInfo> eligible = new JCG.List<SegmentCommitInfo>();
for (int idx = tooBigCount; idx < infosSorted.Count; idx++)
{
SegmentCommitInfo info = infosSorted[idx];
if (merging.Contains(info))
{
mergingBytes += info.GetSizeInBytes();
}
else if (!toBeMerged.Contains(info))
{
eligible.Add(info);
}
}
bool maxMergeIsRunning = mergingBytes >= maxMergedSegmentBytes;
if (Verbose())
{
Message(" allowedSegmentCount=" + allowedSegCountInt + " vs count=" + infosSorted.Count + " (eligible count=" + eligible.Count + ") tooBigCount=" + tooBigCount);
}
if (eligible.Count == 0)
{
return spec;
}
if (eligible.Count >= allowedSegCountInt)
{
// OK we are over budget -- find best merge!
MergeScore bestScore = null;
IList<SegmentCommitInfo> best = null;
bool bestTooLarge = false;
long bestMergeBytes = 0;
// Consider all merge starts:
for (int startIdx = 0; startIdx <= eligible.Count - maxMergeAtOnce; startIdx++)
{
long totAfterMergeBytes = 0;
IList<SegmentCommitInfo> candidate = new JCG.List<SegmentCommitInfo>();
bool hitTooLarge = false;
for (int idx = startIdx; idx < eligible.Count && candidate.Count < maxMergeAtOnce; idx++)
{
SegmentCommitInfo info = eligible[idx];
long segBytes = Size(info);
if (totAfterMergeBytes + segBytes > maxMergedSegmentBytes)
{
hitTooLarge = true;
// NOTE: we continue, so that we can try
// "packing" smaller segments into this merge
// to see if we can get closer to the max
// size; this in general is not perfect since
// this is really "bin packing" and we'd have
// to try different permutations.
continue;
}
candidate.Add(info);
totAfterMergeBytes += segBytes;
}
MergeScore score = Score(candidate, hitTooLarge, mergingBytes);
if (Verbose())
{
Message(" maybe=" + m_writer.Get().SegString(candidate) + " score=" + score.Score + " " + score.Explanation + " tooLarge=" + hitTooLarge + " size=" + string.Format("{0:0.000} MB", totAfterMergeBytes / 1024.0 / 1024.0));
}
// If we are already running a max sized merge
// (maxMergeIsRunning), don't allow another max
// sized merge to kick off:
if ((bestScore == null || score.Score < bestScore.Score) && (!hitTooLarge || !maxMergeIsRunning))
{
best = candidate;
bestScore = score;
bestTooLarge = hitTooLarge;
bestMergeBytes = totAfterMergeBytes;
}
}
if (best != null)
{
if (spec == null)
{
spec = new MergeSpecification();
}
OneMerge merge = new OneMerge(best);
spec.Add(merge);
foreach (SegmentCommitInfo info in merge.Segments)
{
toBeMerged.Add(info);
}
if (Verbose())
{
Message(" add merge=" + m_writer.Get().SegString(merge.Segments) + " size=" + string.Format("{0:0.000} MB", bestMergeBytes / 1024.0 / 1024.0) + " score=" + string.Format("{0:0.000}", bestScore.Score) + " " + bestScore.Explanation + (bestTooLarge ? " [max merge]" : ""));
}
}
else
{
return spec;
}
}
else
{
return spec;
}
}
}
/// <summary>
/// Expert: scores one merge; subclasses can override. </summary>
protected virtual MergeScore Score(IList<SegmentCommitInfo> candidate, bool hitTooLarge, long mergingBytes)
{
long totBeforeMergeBytes = 0;
long totAfterMergeBytes = 0;
long totAfterMergeBytesFloored = 0;
foreach (SegmentCommitInfo info in candidate)
{
long segBytes = Size(info);
totAfterMergeBytes += segBytes;
totAfterMergeBytesFloored += FloorSize(segBytes);
totBeforeMergeBytes += info.GetSizeInBytes();
}
// Roughly measure "skew" of the merge, i.e. how
// "balanced" the merge is (whether the segments are
// about the same size), which can range from
// 1.0/numSegsBeingMerged (good) to 1.0 (poor). Heavily
// lopsided merges (skew near 1.0) is no good; it means
// O(N^2) merge cost over time:
double skew;
if (hitTooLarge)
{
// Pretend the merge has perfect skew; skew doesn't
// matter in this case because this merge will not
// "cascade" and so it cannot lead to N^2 merge cost
// over time:
skew = 1.0 / maxMergeAtOnce;
}
else
{
skew = ((double)FloorSize(Size(candidate[0]))) / totAfterMergeBytesFloored;
}
// Strongly favor merges with less skew (smaller
// mergeScore is better):
double mergeScore = skew;
// Gently favor smaller merges over bigger ones. We
// don't want to make this exponent too large else we
// can end up doing poor merges of small segments in
// order to avoid the large merges:
mergeScore *= Math.Pow(totAfterMergeBytes, 0.05);
// Strongly favor merges that reclaim deletes:
double nonDelRatio = ((double)totAfterMergeBytes) / totBeforeMergeBytes;
mergeScore *= Math.Pow(nonDelRatio, reclaimDeletesWeight);
double finalMergeScore = mergeScore;
return new MergeScoreAnonymousClass(skew, nonDelRatio, finalMergeScore);
}
private class MergeScoreAnonymousClass : MergeScore
{
private readonly double skew;
private readonly double nonDelRatio;
private readonly double finalMergeScore;
public MergeScoreAnonymousClass(double skew, double nonDelRatio, double finalMergeScore)
{
this.skew = skew;
this.nonDelRatio = nonDelRatio;
this.finalMergeScore = finalMergeScore;
}
public override double Score => finalMergeScore;
public override string Explanation => "skew=" + string.Format(CultureInfo.InvariantCulture, "{0:F3}", skew) + " nonDelRatio=" + string.Format(CultureInfo.InvariantCulture, "{0:F3}", nonDelRatio);
}
public override MergeSpecification FindForcedMerges(SegmentInfos infos, int maxSegmentCount, IDictionary<SegmentCommitInfo, bool?> segmentsToMerge)
{
if (Verbose())
{
Message("FindForcedMerges maxSegmentCount=" + maxSegmentCount +
" infos=" + m_writer.Get().SegString(infos.Segments) +
" segmentsToMerge=" + string.Format(J2N.Text.StringFormatter.InvariantCulture, "{0}", segmentsToMerge));
}
JCG.List<SegmentCommitInfo> eligible = new JCG.List<SegmentCommitInfo>();
bool forceMergeRunning = false;
ICollection<SegmentCommitInfo> merging = m_writer.Get().MergingSegments;
bool? segmentIsOriginal = false;
foreach (SegmentCommitInfo info in infos.Segments)
{
if (segmentsToMerge.TryGetValue(info, out bool? isOriginal))
{
segmentIsOriginal = isOriginal;
if (!merging.Contains(info))
{
eligible.Add(info);
}
else
{
forceMergeRunning = true;
}
}
}
if (eligible.Count == 0)
{
return null;
}
if ((maxSegmentCount > 1 && eligible.Count <= maxSegmentCount) || (maxSegmentCount == 1 && eligible.Count == 1 && (segmentIsOriginal == false || IsMerged(infos, eligible[0]))))
{
if (Verbose())
{
Message("already merged");
}
return null;
}
eligible.Sort(new SegmentByteSizeDescending(this));
if (Verbose())
{
Message("eligible=" + string.Format(J2N.Text.StringFormatter.InvariantCulture, "{0}", eligible));
Message("forceMergeRunning=" + forceMergeRunning);
}
int end = eligible.Count;
MergeSpecification spec = null;
// Do full merges, first, backwards:
while (end >= maxMergeAtOnceExplicit + maxSegmentCount - 1)
{
if (spec == null)
{
spec = new MergeSpecification();
}
OneMerge merge = new OneMerge(eligible.GetView(end - maxMergeAtOnceExplicit, maxMergeAtOnceExplicit)); // LUCENENET: Converted end index to length
if (Verbose())
{
Message("add merge=" + m_writer.Get().SegString(merge.Segments));
}
spec.Add(merge);
end -= maxMergeAtOnceExplicit;
}
if (spec == null && !forceMergeRunning)
{
// Do final merge
int numToMerge = end - maxSegmentCount + 1;
OneMerge merge = new OneMerge(eligible.GetView(end - numToMerge, numToMerge)); // LUCENENET: Converted end index to length
if (Verbose())
{
Message("add final merge=" + merge.SegString(m_writer.Get().Directory));
}
spec = new MergeSpecification();
spec.Add(merge);
}
return spec;
}
public override MergeSpecification FindForcedDeletesMerges(SegmentInfos infos)
{
if (Verbose())
{
Message("findForcedDeletesMerges infos=" + m_writer.Get().SegString(infos.Segments) + " forceMergeDeletesPctAllowed=" + forceMergeDeletesPctAllowed);
}
JCG.List<SegmentCommitInfo> eligible = new JCG.List<SegmentCommitInfo>();
ICollection<SegmentCommitInfo> merging = m_writer.Get().MergingSegments;
foreach (SegmentCommitInfo info in infos.Segments)
{
double pctDeletes = 100.0 * ((double)m_writer.Get().NumDeletedDocs(info)) / info.Info.DocCount;
if (pctDeletes > forceMergeDeletesPctAllowed && !merging.Contains(info))
{
eligible.Add(info);
}
}
if (eligible.Count == 0)
{
return null;
}
eligible.Sort(new SegmentByteSizeDescending(this));
if (Verbose())
{
Message("eligible=" + string.Format(J2N.Text.StringFormatter.InvariantCulture, "{0}", eligible));
}
int start = 0;
MergeSpecification spec = null;
while (start < eligible.Count)
{
// Don't enforce max merged size here: app is explicitly
// calling forceMergeDeletes, and knows this may take a
// long time / produce big segments (like forceMerge):
int end = Math.Min(start + maxMergeAtOnceExplicit, eligible.Count);
if (spec == null)
{
spec = new MergeSpecification();
}
OneMerge merge = new OneMerge(eligible.GetView(start, end - start)); // LUCENENET: Converted end index to length
if (Verbose())
{
Message("add merge=" + m_writer.Get().SegString(merge.Segments));
}
spec.Add(merge);
start = end;
}
return spec;
}
protected override void Dispose(bool disposing)
{
}
private long FloorSize(long bytes)
{
return Math.Max(floorSegmentBytes, bytes);
}
private bool Verbose()
{
IndexWriter w = m_writer.Get();
return w != null && w.infoStream.IsEnabled("TMP");
}
private void Message(string message)
{
m_writer.Get().infoStream.Message("TMP", message);
}
public override string ToString()
{
StringBuilder sb = new StringBuilder("[" + this.GetType().Name + ": ");
sb.Append("maxMergeAtOnce=").Append(maxMergeAtOnce).Append(", ");
sb.Append("maxMergeAtOnceExplicit=").Append(maxMergeAtOnceExplicit).Append(", ");
sb.Append("maxMergedSegmentMB=").Append(maxMergedSegmentBytes / 1024 / 1024.0).Append(", ");
sb.Append("floorSegmentMB=").Append(floorSegmentBytes / 1024 / 1024.0).Append(", ");
sb.Append("forceMergeDeletesPctAllowed=").Append(forceMergeDeletesPctAllowed).Append(", ");
sb.Append("segmentsPerTier=").Append(segsPerTier).Append(", ");
sb.Append("maxCFSSegmentSizeMB=").Append(MaxCFSSegmentSizeMB).Append(", ");
sb.Append("noCFSRatio=").Append(m_noCFSRatio);
return sb.ToString();
}
}
} | 42.480537 | 314 | 0.512955 | [
"Apache-2.0"
] | Spinks90/YAFNET | yafsrc/Lucene.Net/Lucene.Net/Index/TieredMergePolicy.cs | 30,906 | C# |
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace TasksAndState
{
public class Test
{
private const int Elements = 200000;
private static int _globalSum;
private static void AddFunction()
{
_globalSum += Data.Default.Value;
}
[Benchmark]
public void CaptureState()
{
_globalSum = 0;
for (int i = 0; i < Elements; ++i)
{
var data = new Data { Value = i };
TaskStub.StartNew(() => { _globalSum += data.Value; });
}
}
[Benchmark]
public void PassStateAsParameter()
{
_globalSum = 0;
for (int i = 0; i < Elements; ++i)
{
var data = new Data { Value = i };
TaskStub.StartNew(d => { _globalSum += (d as Data).Value; }, data);
}
}
[Benchmark]
public void NoCapturedState()
{
_globalSum = 0;
for (int i = 0; i < Elements; ++i)
{
TaskStub.StartNew(() => { _globalSum += Data.Default.Value; });
}
}
[Benchmark]
public void NoStateAndNoLambda()
{
_globalSum = 0;
for (int i = 0; i < Elements; ++i)
{
TaskStub.StartNew(AddFunction);
}
}
#region struct
[Benchmark]
public void SCaptureState()
{
_globalSum = 0;
for (int i = 0; i < Elements; ++i)
{
var data = new Data { Value = i };
STaskStub.StartNew(() => { _globalSum += data.Value; });
}
}
[Benchmark]
public void SPassStateAsParameter()
{
_globalSum = 0;
for (int i = 0; i < Elements; ++i)
{
var data = new Data { Value = i };
STaskStub.StartNew(d => { _globalSum += (d as Data).Value; }, data);
}
}
[Benchmark]
public void SNoCapturedState()
{
_globalSum = 0;
for (int i = 0; i < Elements; ++i)
{
STaskStub.StartNew(() => { _globalSum += Data.Default.Value; });
}
}
[Benchmark]
public void SNoStateAndNoLambda()
{
_globalSum = 0;
for (int i = 0; i < Elements; ++i)
{
STaskStub.StartNew(AddFunction);
}
}
#endregion
}
class Program
{
static void Main(string[] args)
{
BenchmarkRunner.Run<Test>();
}
}
}
| 24.491071 | 84 | 0.429457 | [
"MIT"
] | dinazil/look-mommy-no-gc | Demos/05_Lambdas/TasksAndState/TasksAndState/Program.cs | 2,745 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.UI.Xaml.Controls
{
#if false || false || false || false || false
#if false || false || false || false || false
[global::Uno.NotImplemented]
#endif
public enum ContentDialogPlacement
{
// Skipping already declared field Windows.UI.Xaml.Controls.ContentDialogPlacement.Popup
// Skipping already declared field Windows.UI.Xaml.Controls.ContentDialogPlacement.InPlace
}
#endif
}
| 31.75 | 92 | 0.75 | [
"Apache-2.0"
] | JTOne123/uno | src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Controls/ContentDialogPlacement.cs | 508 | C# |
namespace DOAN
{
partial class FrmReportSoLuongSPBan
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
this.PROC_SoLuongSPBanTheoNgayBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.QLPM_KaraokeDataSet = new DOAN.QLPM_KaraokeDataSet();
this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer();
this.labeltoday = new System.Windows.Forms.Label();
this.labelfromday = new System.Windows.Forms.Label();
this.btnLoadData = new DevExpress.XtraEditors.SimpleButton();
this.dtpToDay = new System.Windows.Forms.DateTimePicker();
this.dtpFromDay = new System.Windows.Forms.DateTimePicker();
this.PROC_SoLuongSPBanTheoNgayTableAdapter = new DOAN.QLPM_KaraokeDataSetTableAdapters.PROC_SoLuongSPBanTheoNgayTableAdapter();
this.labelTuNgay = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.labelDenNgay = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.PROC_SoLuongSPBanTheoNgayBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.QLPM_KaraokeDataSet)).BeginInit();
this.SuspendLayout();
//
// PROC_SoLuongSPBanTheoNgayBindingSource
//
this.PROC_SoLuongSPBanTheoNgayBindingSource.DataMember = "PROC_SoLuongSPBanTheoNgay";
this.PROC_SoLuongSPBanTheoNgayBindingSource.DataSource = this.QLPM_KaraokeDataSet;
//
// QLPM_KaraokeDataSet
//
this.QLPM_KaraokeDataSet.DataSetName = "QLPM_KaraokeDataSet";
this.QLPM_KaraokeDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// reportViewer1
//
this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
reportDataSource1.Name = "DataSetSoLuongSPBanTheoNgay";
reportDataSource1.Value = this.PROC_SoLuongSPBanTheoNgayBindingSource;
this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1);
this.reportViewer1.LocalReport.ReportEmbeddedResource = "DOAN.DataSetReportSLSPBanTheoNgay.rdlc";
this.reportViewer1.Location = new System.Drawing.Point(0, 0);
this.reportViewer1.Name = "reportViewer1";
this.reportViewer1.Size = new System.Drawing.Size(962, 336);
this.reportViewer1.TabIndex = 0;
//
// labeltoday
//
this.labeltoday.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.labeltoday.AutoSize = true;
this.labeltoday.BackColor = System.Drawing.Color.White;
this.labeltoday.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labeltoday.Location = new System.Drawing.Point(824, 210);
this.labeltoday.Name = "labeltoday";
this.labeltoday.Size = new System.Drawing.Size(46, 19);
this.labeltoday.TabIndex = 10;
this.labeltoday.Text = "Đến :";
//
// labelfromday
//
this.labelfromday.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.labelfromday.AutoSize = true;
this.labelfromday.BackColor = System.Drawing.Color.White;
this.labelfromday.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelfromday.Location = new System.Drawing.Point(824, 149);
this.labelfromday.Name = "labelfromday";
this.labelfromday.Size = new System.Drawing.Size(38, 19);
this.labelfromday.TabIndex = 9;
this.labelfromday.Text = "Từ :";
//
// btnLoadData
//
this.btnLoadData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnLoadData.Location = new System.Drawing.Point(828, 281);
this.btnLoadData.Name = "btnLoadData";
this.btnLoadData.Size = new System.Drawing.Size(94, 44);
this.btnLoadData.TabIndex = 8;
this.btnLoadData.Text = "Tải dữ liệu";
this.btnLoadData.Click += new System.EventHandler(this.btnLoadData_Click);
//
// dtpToDay
//
this.dtpToDay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dtpToDay.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dtpToDay.Location = new System.Drawing.Point(828, 232);
this.dtpToDay.Name = "dtpToDay";
this.dtpToDay.Size = new System.Drawing.Size(94, 20);
this.dtpToDay.TabIndex = 7;
//
// dtpFromDay
//
this.dtpFromDay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dtpFromDay.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dtpFromDay.Location = new System.Drawing.Point(828, 171);
this.dtpFromDay.Name = "dtpFromDay";
this.dtpFromDay.Size = new System.Drawing.Size(94, 20);
this.dtpFromDay.TabIndex = 6;
//
// PROC_SoLuongSPBanTheoNgayTableAdapter
//
this.PROC_SoLuongSPBanTheoNgayTableAdapter.ClearBeforeFill = true;
//
// labelTuNgay
//
this.labelTuNgay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.labelTuNgay.AutoSize = true;
this.labelTuNgay.BackColor = System.Drawing.Color.White;
this.labelTuNgay.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTuNgay.Location = new System.Drawing.Point(805, 39);
this.labelTuNgay.Name = "labelTuNgay";
this.labelTuNgay.Size = new System.Drawing.Size(45, 19);
this.labelTuNgay.TabIndex = 13;
this.labelTuNgay.Text = "????";
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.White;
this.label2.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(488, 39);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(301, 19);
this.label2.TabIndex = 12;
this.label2.Text = "Thời gian thống kê dữ liệu từ ngày :";
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.White;
this.label1.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(647, 118);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(282, 19);
this.label1.TabIndex = 11;
this.label1.Text = "Chọn thời gian cần xem thống kê ";
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.Color.White;
this.label3.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(695, 70);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(94, 19);
this.label3.TabIndex = 14;
this.label3.Text = "đến ngày :";
//
// labelDenNgay
//
this.labelDenNgay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.labelDenNgay.AutoSize = true;
this.labelDenNgay.BackColor = System.Drawing.Color.White;
this.labelDenNgay.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelDenNgay.Location = new System.Drawing.Point(805, 70);
this.labelDenNgay.Name = "labelDenNgay";
this.labelDenNgay.Size = new System.Drawing.Size(45, 19);
this.labelDenNgay.TabIndex = 15;
this.labelDenNgay.Text = "????";
//
// FrmReportSoLuongSPBan
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(962, 336);
this.Controls.Add(this.labelDenNgay);
this.Controls.Add(this.label3);
this.Controls.Add(this.labelTuNgay);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.labeltoday);
this.Controls.Add(this.labelfromday);
this.Controls.Add(this.btnLoadData);
this.Controls.Add(this.dtpToDay);
this.Controls.Add(this.dtpFromDay);
this.Controls.Add(this.reportViewer1);
this.Name = "FrmReportSoLuongSPBan";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Thống kê số lượng sản phẩm bán";
this.Load += new System.EventHandler(this.FrmReportSoLuongSPBan_Load);
((System.ComponentModel.ISupportInitialize)(this.PROC_SoLuongSPBanTheoNgayBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.QLPM_KaraokeDataSet)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Microsoft.Reporting.WinForms.ReportViewer reportViewer1;
private System.Windows.Forms.Label labeltoday;
private System.Windows.Forms.Label labelfromday;
private DevExpress.XtraEditors.SimpleButton btnLoadData;
private System.Windows.Forms.DateTimePicker dtpToDay;
private System.Windows.Forms.DateTimePicker dtpFromDay;
private System.Windows.Forms.BindingSource PROC_SoLuongSPBanTheoNgayBindingSource;
private QLPM_KaraokeDataSet QLPM_KaraokeDataSet;
private QLPM_KaraokeDataSetTableAdapters.PROC_SoLuongSPBanTheoNgayTableAdapter PROC_SoLuongSPBanTheoNgayTableAdapter;
private System.Windows.Forms.Label labelTuNgay;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label labelDenNgay;
}
} | 56.648069 | 164 | 0.637169 | [
"Apache-2.0"
] | anckc96/PMQL_Karaoke | DOAN/FrmReportSoLuongSPBan.Designer.cs | 13,250 | C# |
using UnityEngine;
namespace Crosstales.FB.Util
{
/// <summary>Various helper functions.</summary>
public abstract class Helper : Common.Util.BaseHelper
{
#region Static properties
/// <summary>Checks if the current platform is supported.</summary>
/// <returns>True if the current platform is supported.</returns>
public static bool isSupportedPlatform
{
get
{
return isWindowsPlatform || isMacOSPlatform;
}
}
#endregion
}
}
// © 2017-2018 crosstales LLC (https://www.crosstales.com) | 25.541667 | 75 | 0.60522 | [
"MIT"
] | atalantus/BwInf36_Runde02 | Seminararbeit - Abgabe - 01.11.2018/Aufgabe 3 - Quo vadis, Quax/Projekt Dateien/Assets/Plugins/crosstales/FileBrowser/Scripts/Util/Helper.cs | 616 | C# |
using ReactNative.Bridge;
using ReactNative.DevSupport;
using ReactNative.Modules.Core;
using ReactNative.Modules.DevSupport;
using ReactNative.Tracing;
using ReactNative.UIManager;
using ReactNative.UIManager.Events;
using System;
using System.Collections.Generic;
namespace ReactNative
{
/// <summary>
/// Package defining core framework modules (e.g., <see cref="UIManagerModule"/>).
/// It should be used for modules that require special integration with
/// other framework parts (e.g., with the list of packages to load view
/// managers from).
/// </summary>
class CoreModulesPackage : IReactPackage
{
private readonly IReactInstanceManager _reactInstanceManager;
private readonly Action _hardwareBackButtonHandler;
private readonly UIImplementationProvider _uiImplementationProvider;
public CoreModulesPackage(
IReactInstanceManager reactInstanceManager,
Action hardwareBackButtonHandler,
UIImplementationProvider uiImplementationProvider)
{
_reactInstanceManager = reactInstanceManager;
_hardwareBackButtonHandler = hardwareBackButtonHandler;
_uiImplementationProvider = uiImplementationProvider;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Caller manages scope of returned list of disposables.")]
public IReadOnlyList<INativeModule> CreateNativeModules(ReactContext reactContext)
{
var uiManagerModule = default(INativeModule);
using (Tracer.Trace(Tracer.TRACE_TAG_REACT_BRIDGE, "createUIManagerModule").Start())
{
var viewManagerList = _reactInstanceManager.CreateAllViewManagers(reactContext);
uiManagerModule = new UIManagerModule(
reactContext,
viewManagerList,
_uiImplementationProvider.Create(
reactContext,
viewManagerList));
}
return new List<INativeModule>
{
//new AnimationsDebugModule(
// reactContext,
// _reactInstanceManager.DevSupportManager.DevSettings),
//new SystemInfoModule(),
new DeviceEventManagerModule(reactContext, _hardwareBackButtonHandler),
new ExceptionsManagerModule(_reactInstanceManager.DevSupportManager),
new Timing(reactContext),
new SourceCodeModule(
_reactInstanceManager.SourceUrl,
_reactInstanceManager.DevSupportManager.SourceMapUrl),
uiManagerModule,
//new DebugComponentOwnershipModule(reactContext),
};
}
public IReadOnlyList<Type> CreateJavaScriptModulesConfig()
{
return new List<Type>
{
typeof(RCTDeviceEventEmitter),
typeof(JSTimersExecution),
typeof(RCTEventEmitter),
typeof(RCTNativeAppEventEmitter),
typeof(AppRegistry),
// TODO: some tracing module
typeof(HMRClient),
//typeof(RCTDebugComponentOwnership),
};
}
public IReadOnlyList<IViewManager> CreateViewManagers(
ReactContext reactContext)
{
return new List<IViewManager>(0);
}
}
}
| 40.932584 | 202 | 0.618721 | [
"Apache-2.0"
] | neelimabhukya/readypolicy-ui | node_modules/react-native-windows/ReactWindows/ReactNative/CoreModulesPackage.cs | 3,645 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Drawing;
using System.Globalization;
using WinForms.Common.Tests;
using Xunit;
namespace System.Windows.Forms.Tests
{
public class ColumnHeaderConverterTests : IClassFixture<ThreadExceptionFixture>
{
public static TheoryData<Type, bool> CanConvertFromData =>
CommonTestHelper.GetConvertFromTheoryData();
[Theory]
[MemberData(nameof(CanConvertFromData))]
[InlineData(typeof(ColumnHeader), false)]
public void ColumnHeaderConverter_CanConvertFrom_Invoke_ReturnsExpected(Type sourceType, bool expected)
{
var converter = new ColumnHeaderConverter();
Assert.Equal(expected, converter.CanConvertFrom(sourceType));
}
[Theory]
[InlineData("value")]
[InlineData(1)]
[InlineData(null)]
public void ColumnHeaderConverter_ConvertFrom_InvalidValue_ThrowsNotSupportedException(object value)
{
var converter = new ColumnHeaderConverter();
Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value));
}
[Theory]
[InlineData(typeof(string), true)]
[InlineData(typeof(InstanceDescriptor), true)]
[InlineData(typeof(ColumnHeader), false)]
[InlineData(typeof(int), false)]
[InlineData(null, false)]
public void ColumnHeaderConverter_CanConvertTo_Invoke_ReturnsExpected(Type destinationType, bool expected)
{
var converter = new ColumnHeaderConverter();
Assert.Equal(expected, converter.CanConvertTo(destinationType));
}
public static IEnumerable<object[]> ConvertTo_InstanceDescriptor_TestData()
{
yield return new object[]
{
new ColumnHeader(),
Array.Empty<Type>(),
Array.Empty<object>()
};
yield return new object[]
{
new ColumnHeader("imageKey"),
new Type[] { typeof(string) },
new object[] { "imageKey" }
};
yield return new object[]
{
new ColumnHeader(1),
new Type[] { typeof(int) },
new object[] { 1 }
};
yield return new object[]
{
new PrivateIntConstructor() { ImageIndex = 1 },
Array.Empty<Type>(),
Array.Empty<object>()
};
yield return new object[]
{
new PrivateStringConstructor() { ImageKey = "imageKey" },
Array.Empty<Type>(),
Array.Empty<object>()
};
yield return new object[]
{
new PrivateDefaultConstructor("imageKey"),
new Type[] { typeof(string) },
new object[] { "imageKey" }
};
yield return new object[]
{
new PrivateDefaultConstructor(1),
new Type[] { typeof(int) },
new object[] { 1 }
};
}
[Theory]
[MemberData(nameof(ConvertTo_InstanceDescriptor_TestData))]
public void ColumnHeaderConverter_ConvertTo_InstanceDescriptor_ReturnsExpected(ColumnHeader value, Type[] parameterTypes, object[] arguments)
{
var converter = new ColumnHeaderConverter();
InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(value, typeof(InstanceDescriptor)));
Assert.Equal(value.GetType().GetConstructor(parameterTypes), descriptor.MemberInfo);
Assert.Equal(arguments, descriptor.Arguments);
}
[Fact]
public void ColumnHeaderConverter_ConvertTo_NoPublicDefaultConstructor_ThrowsArgumentException()
{
var value = new PrivateDefaultConstructor(-1);
var converter = new ColumnHeaderConverter();
Assert.Throws<ArgumentException>(null, () => converter.ConvertTo(value, typeof(InstanceDescriptor)));
}
[Theory]
[InlineData(null, "")]
[InlineData(1, "1")]
public void ColumnHeaderConverter_ConvertTo_String_ReturnsExpected(object value, string expected)
{
var converter = new ColumnHeaderConverter();
Assert.Equal(expected, converter.ConvertTo(value, typeof(string)));
}
[Fact]
public void ColumnHeaderConverter_ConvertTo_NullDestinationType_ThrowsArgumentNullException()
{
var converter = new ColumnHeaderConverter();
Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null));
}
[Fact]
public void ColumnHeaderConverter_ConvertTo_ValueNotThrowsNotSupportedException()
{
var converter = new ColumnHeaderConverter();
Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor)));
}
[Theory]
[InlineData(typeof(ColumnHeader))]
[InlineData(typeof(int))]
public void ColumnHeaderConverter_ConvertTo_InvalidDestinationType_ThrowsNotSupportedException(Type destinationType)
{
var converter = new ColumnHeaderConverter();
Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ColumnHeader(), destinationType));
}
[Fact]
public void ColumnHeaderConverter_GetPropertiesSupported_Invoke_ReturnsTrue()
{
var converter = new ColumnHeaderConverter();
Assert.True(converter.GetPropertiesSupported(null));
}
[Fact]
public void ColumnHeaderConverter_GetProperties_Invoke_ReturnsExpected()
{
var converter = new ColumnHeaderConverter();
var item = new ColumnHeader();
Assert.Equal(TypeDescriptor.GetProperties(item, null).Count, converter.GetProperties(null, item, null).Count);
}
[Fact]
public void ColumnHeaderConverter_GetStandardValues_Invoke_ReturnsNull()
{
var converter = new ColumnHeaderConverter();
Assert.Null(converter.GetStandardValues(null));
}
[Fact]
public void ColumnHeaderConverter_GetStandardValuesExclusive_Invoke_ReturnsFalse()
{
var converter = new ColumnHeaderConverter();
Assert.False(converter.GetStandardValuesExclusive(null));
}
[Fact]
public void ColumnHeaderConverter_GetStandardValuesSupported_Invoke_ReturnsFalse()
{
var converter = new ColumnHeaderConverter();
Assert.False(converter.GetStandardValuesSupported(null));
}
private class PrivateDefaultConstructor : ColumnHeader
{
private PrivateDefaultConstructor() : base() { }
public PrivateDefaultConstructor(string imageKey) : base(imageKey) { }
public PrivateDefaultConstructor(int imageIndex) : base(imageIndex) { }
}
private class PrivateStringConstructor : ColumnHeader
{
public PrivateStringConstructor() : base() { }
private PrivateStringConstructor(string imageKey) : base(imageKey) { }
public PrivateStringConstructor(int imageIndex) : base(imageIndex) { }
}
private class PrivateIntConstructor : ColumnHeader
{
public PrivateIntConstructor() : base() { }
public PrivateIntConstructor(string imageKey) : base(imageKey) { }
private PrivateIntConstructor(int imageIndex) : base(imageIndex) { }
}
}
}
| 37.985782 | 149 | 0.621959 | [
"MIT"
] | GrabYourPitchforks/winforms | src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ColumnHeaderConverterTests.cs | 8,017 | C# |
using System
using OpenQA.Selenium
using OpenQA.Selenium.Chrome
using System.Threading
using System.Collections.Generic
using System.Collections.ObjectModel
using OpenQA.Selenium.Support.UI
namespace c__test
{
class UI
{
const string LOGIN_URL = "https://rxce.in/#login"
const string MAIN_PAGE_URL = "https://rxce.in/#/win"
const string GREEN_CIRCLE_STYLE = "background-color: rgb(0, 230, 118)"
const string RED_CIRCLE_STYLE = "background-color: rgb(255, 23, 68)"
const int GREEN_BUTTON_ID = 17
const int RED_BUTTON_ID = 19
const int BLUE_BUTTON_ID = 0
private string username { get; set; }
private string password { get; set; }
ChromeOptions options = new ChromeOptions()
//options.AddArguments("--headless")
private IWebDriver driver
public UI(string username, string password)
{
this.username = username
this.password = password
driver = new ChromeDriver(@"C:\Users\Dee\Downloads\chromedriver_win32", options)
}
public void Login()
{
driver.Navigate().GoToUrl(LOGIN_URL)
IWebElement mobile = driver.FindElement(By.TagName(@"input[type=text]"))
mobile.SendKeys(this.username)
Sleep(1)
IWebElement password = driver.FindElement(By.TagName(@"input[type=password]"))
password.SendKeys(this.password)
Sleep(1)
driver.FindElement(By.TagName(@"button[type=submit]")).Click()
Sleep(2)
}
public void NavigateToMainUrl()
{
driver.Navigate().GoToUrl(MAIN_PAGE_URL)
Sleep(2)
string cUrl = driver.Url
if (!cUrl.Contains("Win"))
{
driver.Navigate().GoToUrl(MAIN_PAGE_URL)
}
}
public string GetPattern()
{
string result = string.Empty
try
{
result = GetCurrentPattern()
Console.WriteLine("Pattern Fetched: " + result)
while (result.Length < 4)
{
Console.WriteLine("Retrying pattern fetch...")
driver.Navigate().Refresh()
Sleep(3)
result = GetCurrentPattern()
if (result.Length > 4) break
}
}
catch (Exception ex)
{
Console.WriteLine("Pattern fetch issue: " + ex.Message)
}
Console.WriteLine("Pattern Fetched: " + result)
return result
}
public void SelectColor(ColorCode colorCode, int count = 1)
{
Console.WriteLine("Choosen color: " + colorCode.ToString())
if(colorCode == ColorCode.None) return
driver.Navigate().Refresh()
Sleep(2)
ReadOnlyCollection<IWebElement> elements = driver.FindElements(By.TagName("button"))
int colorButtonID = 0
switch (colorCode)
{
case ColorCode.Red:
colorButtonID = RED_BUTTON_ID
break
case ColorCode.Green:
colorButtonID = GREEN_BUTTON_ID
break
case ColorCode.Blue:
colorButtonID = BLUE_BUTTON_ID
break
}
WebDriverWait waitEnable = new WebDriverWait(driver, TimeSpan.FromSeconds(30))
bool btnToBeClicked = waitEnable.Until(condition =>
{
try
{
return elements[colorButtonID].Enabled
}
catch (System.Exception ex)
{
System.Console.WriteLine("Buying exception: " + ex.Message)
return false
}
})
if (btnToBeClicked)
{
elements[colorButtonID].Click()
}
else
{
Console.WriteLine("Button is disabled")
}
Console.WriteLine("Ready to buy")
Sleep(2)
IWebElement btnConfirm = driver.FindElement(By.TagName(@"button[type=submit]"))
btnConfirm.Click()
Sleep(2)
driver.Navigate().Refresh()
System.Console.WriteLine("Buying completed: " + colorCode.ToString())
}
private string GetCurrentPattern()
{
string currentPattern = string.Empty
ReadOnlyCollection<IWebElement> elements = this.driver.FindElements(By.TagName("table"))
IWebElement table = elements[0]
var rows = table.FindElements(By.TagName("tr"))
foreach (var row in rows)
{
if (currentPattern.Length == 10) break
var rowTds = row.FindElements(By.TagName("td"))
if (rowTds.Count < 4) continue
currentPattern += GetColorFromRow(rowTds[3])
}
return currentPattern
}
private static string GetColorFromRow(IWebElement td)
{
var point = td.FindElements(By.ClassName("point"))
if (point.Count == 1)
{
string style = point[0].GetAttribute("style")
if (style.Equals(GREEN_CIRCLE_STYLE))
{
return "G"
}
else if (style.Equals(RED_CIRCLE_STYLE))
{
return "R"
}
}
else if (point.Count == 2)
{
Console.WriteLine("Both color present")
string res = string.Empty
string style = point[0].GetAttribute("style")
if (style.Contains(GREEN_CIRCLE_STYLE))
{
res += "G"
}
else if (style.Contains(RED_CIRCLE_STYLE))
{
res += "R"
}
else
{
res += "B"
}
return res
}
return string.Empty
}
public IWebDriver GetChromeDriver()
{
return this.driver
}
public void Sleep(int timeInSecond)
{
Thread.Sleep(1000 * timeInSecond)
}
public void WaitForNextTick()
{
Console.WriteLine("Waiting for next tick @ " + DateTime.Now.AddMinutes(3).ToLongTimeString())
this.Sleep(190)
}
}
}
| 25.962791 | 99 | 0.601576 | [
"Apache-2.0"
] | Mukeshka/new | UI.cs | 5,582 | C# |
/*
Copyright 2019 - 2021 Inetum
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using BeardedManStudios;
using BeardedManStudios.Forge.Networking;
using BeardedManStudios.Forge.Networking.Unity;
using System;
namespace umi3d.common.collaboration
{
public sealed class UMI3DAuthenticator : IUserAuthenticator
{
private const DebugScope scope = DebugScope.Common | DebugScope.Collaboration | DebugScope.Networking;
private const string sepparator = ":";
private readonly Action<Action<string>> getPin;
private readonly Action<Action<(string, string)>> getLoginPassword;
private readonly Action<Action<IdentityDto>> getIdentity;
private readonly Action<string, Action<bool>> getAuthorized;
public Action<IdentityDto, NetworkingPlayer, Action<bool>> shouldAccdeptPlayer;
private readonly string pin;
private readonly AuthenticationType authenticationType;
public Action<string> LoginSet;
public UMI3DAuthenticator(Action<Action<string>> getPin, Action<Action<(string, string)>> getLoginPassword, Action<Action<IdentityDto>> getIdentity)
{
this.getIdentity = getIdentity;
this.getPin = getPin;
this.getLoginPassword = getLoginPassword;
authenticationType = AuthenticationType.None;
}
public UMI3DAuthenticator(string pin)
{
this.pin = pin;
authenticationType = AuthenticationType.Pin;
}
public UMI3DAuthenticator(Action<string, Action<bool>> getAuthorized)
{
this.getAuthorized = getAuthorized;
authenticationType = AuthenticationType.Basic;
}
public UMI3DAuthenticator()
{
authenticationType = AuthenticationType.None;
}
public void AcceptChallenge(NetWorker networker, BMSByte challenge, Action<BMSByte> authServerAction, Action rejectServerAction)
{
AuthenticationType type = challenge.GetBasicType<AuthenticationType>();
switch (type)
{
case AuthenticationType.None:
MainThreadManager.Run(() =>
{
sendAuthServerAction("", authServerAction);
});
break;
case AuthenticationType.Basic:
MainThreadManager.Run(() =>
{
getAuthLoginPassword((auth) => sendAuthServerAction(auth, authServerAction));
});
break;
case AuthenticationType.Pin:
MainThreadManager.Run(() =>
{
getAuthPin((auth) => sendAuthServerAction(auth, authServerAction));
});
break;
default:
UMI3DLogger.LogWarning($"Unknow AuthenticationType [{type}]", scope);
rejectServerAction();
break;
}
}
public void IssueChallenge(NetWorker networker, NetworkingPlayer player, Action<NetworkingPlayer, BMSByte> issueChallengeAction, Action<NetworkingPlayer> skipAuthAction)
{
issueChallengeAction(player, ObjectMapper.BMSByte(authenticationType));
}
public void VerifyResponse(NetWorker networker, NetworkingPlayer player, BMSByte response, Action<NetworkingPlayer> authUserAction, Action<NetworkingPlayer> rejectUserAction)
{
string basicString = response.GetBasicType<string>();
var identity = UMI3DDto.FromBson(response.GetByteArray(response.StartIndex())) as IdentityDto;
MainThreadManager.Run(() =>
{
switch (authenticationType)
{
case AuthenticationType.None:
AcceptPlayer(identity, player, () => authUserAction(player), () => rejectUserAction(player));
break;
case AuthenticationType.Basic:
getAuthorized(basicString, (answer) =>
{
if (answer)
AcceptPlayer(identity, player, () => authUserAction(player), () => rejectUserAction(player));
else
rejectUserAction(player);
});
break;
case AuthenticationType.Pin:
if (basicString == pin)
AcceptPlayer(identity, player, () => authUserAction(player), () => rejectUserAction(player));
else
rejectUserAction(player);
break;
default:
UMI3DLogger.LogWarning($"Unknow AuthenticationType [{authenticationType}]", scope);
rejectUserAction(player);
break;
}
});
}
private void AcceptPlayer(IdentityDto identity, NetworkingPlayer player, Action authServerAction, Action rejectServerAction)
{
if (shouldAccdeptPlayer == null)
{
authServerAction();
}
else
{
shouldAccdeptPlayer(identity, player, (b) =>
{
if (b)
authServerAction();
else
rejectServerAction();
});
}
}
private void sendAuthServerAction(string auth, Action<BMSByte> authServerAction)
{
getIdentity((id) =>
{
authServerAction(ObjectMapper.BMSByte(auth, id.ToBson()));
});
}
private void getAuthLoginPassword(Action<string> callback)
{
if (getLoginPassword == null)
{
callback?.Invoke("");
}
else
{
getLoginPassword.Invoke((k) =>
{
(string login, string password) = k;
LoginSet?.Invoke(login);
callback.Invoke(login + sepparator + password);
});
}
}
private void getAuthPin(Action<string> callback)
{
if (getPin == null)
{
callback?.Invoke("");
}
else
{
getPin.Invoke((pin) =>
{
callback.Invoke(pin);
});
}
}
}
} | 37.046154 | 182 | 0.539452 | [
"Apache-2.0"
] | Gfi-Innovation/UMI3D-SDK | UMI3D-SDK/Assets/UMI3D SDK/Common/Collaboration/Runtime/Networking/UMI3DAuthenticator.cs | 7,226 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace Reverse_Polish_Notation
{
class oneadd
{
//this function will take the postfix expression then solve that expression according to the one address mode
public void evaluate(string postexp, string infix)
{
FileStream aFile = new FileStream("C:/Output.txt", FileMode.Create, FileAccess.Write);//It is open in create mode because if there is any file by the name of output is already (in case of second expevaluation)remove that file first
StreamWriter sw = new StreamWriter(aFile);
byte[] chr = new byte[100];
int i = 0, size = postexp.Length;
intstack stk = new intstack(size);
while (i < size)
{
char ch = postexp[i];
if (ch == '#')//for negative sign
{
double operand = Convert.ToInt32(postexp[++i]) - 48;
stk.push(-1 * operand);
}
else if (ch >= '0' && ch <= '9')//for converting into the digit from character
{
double operand = Convert.ToInt32(ch) - 48;
stk.push(operand);
}
else if (ch == '+' || ch == '-' || ch == '*' || ch == '/')//for operators
{
double op1 = stk.pop();
double op2 = stk.pop();
if (ch == '+')
{
sw.WriteLine("LOAD {0}", op2);
double reg = op2;
sw.WriteLine("ADD {0}", op1);
reg += op1;
sw.WriteLine("STOR {0}", "stack");
stk.push(reg);
}
else if (ch == '-')
{
sw.WriteLine("LOAD {0}", op2);
double reg = op2;
sw.WriteLine("SUB {0}", op1);
reg -= op1;
sw.WriteLine("STOR {0}", "stack");
stk.push(reg);
}
else if (ch == '*')
{
sw.WriteLine("LOAD {0}", op2);
double reg = op2;
sw.WriteLine("MUL {0}", op1);
reg *= op1;
sw.WriteLine("STOR {0}", "stack");
stk.push(reg);
}
else if (ch == '/')
{
sw.WriteLine("LOAD {0}", op2);
double reg = op2;
sw.WriteLine("DIV {0}", op1);
reg /= op1;
sw.WriteLine("STOR {0}", "stack");
stk.push(reg);
}
}
i++;
}
sw.WriteLine(" ");
sw.WriteLine(" ");
sw.WriteLine("\t\t\tMOV Result:\t{0}", stk.pop());
sw.WriteLine("\n\n\t\tPrepeared By:\n\t\t\t\tBenjamin Ngarambe");
sw.Close();
}
}
}
| 39.54878 | 243 | 0.385754 | [
"Unlicense"
] | benjaminngarambe/Project004 | Reverse Polish Notation/oneadd.cs | 3,243 | C# |
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using System;
using System.Collections.Generic;
using System.Text;
namespace Havit.Blazor.Components.Web
{
/// <summary>
/// Build render fragments for specific scenarios.
/// </summary>
public static class RenderFragmentBuilder
{
/// <summary>
/// Returns RenderFragment to render "nothing". Implementation returns <c>null</c>.
/// </summary>
public static RenderFragment Empty()
{
return null;
}
/// <summary>
/// Returns RenderFragment which renders content and template (it is expected at least one of argument is null).
/// If both are <c>null</c>, returns <see cref="Empty"/>.
/// </summary>
public static RenderFragment CreateFrom(string content, RenderFragment template)
{
if (content is null && template is null)
{
return Empty();
}
return (RenderTreeBuilder builder) =>
{
builder.AddContent(0, content); // null check: if string null, use String.Empty
builder.AddContent(1, template); // null check: used inside
};
}
}
}
| 26.609756 | 116 | 0.694775 | [
"MIT"
] | havit/Havit.Blazor | Havit.Blazor.Components.Web/RenderFragmentBuilder.cs | 1,093 | C# |
using Microsoft.EntityFrameworkCore;
using NerdStore.Core.Interfaces.UnitOfWork;
using NerdStore.Core.Mediator;
using NerdStore.Core.Messages;
using NerdStore.Payments.Business.Entities;
using NerdStore.Payments.Data.Extensions;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace NerdStore.Payments.Data.Context
{
public class PaymentsContext : DbContext, IUnitOfWork
{
private readonly IMediatorHandler _mediatorHandler;
public DbSet<Payment> Payments { get; set; }
public DbSet<Transaction> Transactions { get; set; }
public PaymentsContext(DbContextOptions<PaymentsContext> options, IMediatorHandler mediatorHandler) : base(options)
{
_mediatorHandler = mediatorHandler;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
foreach (var entity in modelBuilder.Model.GetEntityTypes())
{
var properties =
entity.GetProperties().Where(x => x.ClrType == typeof(string));
foreach (var property in properties)
{
if (string.IsNullOrEmpty(property.GetColumnType()) && !property.GetMaxLength().HasValue)
{
property.SetColumnType("varchar(100)");
}
}
}
modelBuilder.Ignore<Event>();
modelBuilder.ApplyConfigurationsFromAssembly(typeof(PaymentsContext).Assembly);
foreach (var relationship in modelBuilder.Model.GetEntityTypes().SelectMany(x => x.GetForeignKeys()))
{
relationship.DeleteBehavior = DeleteBehavior.ClientSetNull;
}
}
public async Task<bool> Commit()
{
foreach (var entry in ChangeTracker.Entries()
.Where(e => e.Entity.GetType().GetProperty("CreatedAt") != null))
{
if (entry.State == EntityState.Added)
entry.Property("CreatedAt").CurrentValue = DateTime.Now;
if (entry.State == EntityState.Modified)
entry.Property("CreatedAt").IsModified = false;
}
var success = await base.SaveChangesAsync() > 0;
if (success)
await _mediatorHandler.PublishNotifications(this);
return success;
}
}
}
| 33.666667 | 123 | 0.601898 | [
"MIT"
] | fesnarriaga/courses | desenvolvedor-io/06_dominios-ricos/NerdStore/src/NerdStore.Payments.Data/Context/PaymentsContext.cs | 2,426 | C# |
using System;
using System.Collections.Generic;
namespace SplunkTracing
{
public sealed class Reference : IEquatable<Reference>
{
public SpanContext Context { get; }
public string ReferenceType { get; }
public Reference(SpanContext context, string referenceType)
{
Context = context ?? throw new ArgumentNullException(nameof(context));
ReferenceType = referenceType ?? throw new ArgumentNullException(nameof(referenceType));
}
public override bool Equals(object obj)
{
return Equals(obj as Reference);
}
public bool Equals(Reference other)
{
return other != null &&
EqualityComparer<SpanContext>.Default.Equals(Context, other.Context)
&& ReferenceType == other.ReferenceType;
}
public override int GetHashCode()
{
var hashCode = 2083322454;
hashCode = hashCode * -1521134295 + EqualityComparer<SpanContext>.Default.GetHashCode(Context);
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(ReferenceType);
return hashCode;
}
}
}
| 31.512821 | 108 | 0.616762 | [
"MIT"
] | splnkit/splunk-tracer-csharp | src/SplunkTracing/Reference.cs | 1,229 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace Bigvgames.Models.ManageViewModels
{
public class VerifyPhoneNumberViewModel
{
[Required]
public string Code { get; set; }
[Required]
[Phone]
[Display(Name = "Phone number")]
public string PhoneNumber { get; set; }
}
}
| 21.6 | 47 | 0.673611 | [
"Apache-2.0"
] | BIGVGAMES/bigvgames.com | Models/ManageViewModels/VerifyPhoneNumberViewModel.cs | 432 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the lambda-2015-03-31.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Net;
using Amazon.Lambda.Model;
using Amazon.Lambda.Model.Internal.MarshallTransformations;
using Amazon.Lambda.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.Lambda
{
/// <summary>
/// Implementation for accessing Lambda
///
/// AWS Lambda
/// <para>
/// <b>Overview</b>
/// </para>
///
/// <para>
/// This is the <i>AWS Lambda API Reference</i>. The AWS Lambda Developer Guide provides
/// additional information. For the service overview, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/welcome.html">What
/// is AWS Lambda</a>, and for information about how the service works, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html">AWS
/// Lambda: How it Works</a> in the <b>AWS Lambda Developer Guide</b>.
/// </para>
/// </summary>
public partial class AmazonLambdaClient : AmazonServiceClient, IAmazonLambda
{
private static IServiceMetadata serviceMetadata = new AmazonLambdaMetadata();
#region Constructors
/// <summary>
/// Constructs AmazonLambdaClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
public AmazonLambdaClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonLambdaConfig()) { }
/// <summary>
/// Constructs AmazonLambdaClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="region">The region to connect.</param>
public AmazonLambdaClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonLambdaConfig{RegionEndpoint = region}) { }
/// <summary>
/// Constructs AmazonLambdaClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="config">The AmazonLambdaClient Configuration Object</param>
public AmazonLambdaClient(AmazonLambdaConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary>
/// Constructs AmazonLambdaClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
public AmazonLambdaClient(AWSCredentials credentials)
: this(credentials, new AmazonLambdaConfig())
{
}
/// <summary>
/// Constructs AmazonLambdaClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="region">The region to connect.</param>
public AmazonLambdaClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonLambdaConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonLambdaClient with AWS Credentials and an
/// AmazonLambdaClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonLambdaClient Configuration Object</param>
public AmazonLambdaClient(AWSCredentials credentials, AmazonLambdaConfig clientConfig)
: base(credentials, clientConfig)
{
}
/// <summary>
/// Constructs AmazonLambdaClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
public AmazonLambdaClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonLambdaConfig())
{
}
/// <summary>
/// Constructs AmazonLambdaClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="region">The region to connect.</param>
public AmazonLambdaClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonLambdaConfig() {RegionEndpoint=region})
{
}
/// <summary>
/// Constructs AmazonLambdaClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonLambdaClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="clientConfig">The AmazonLambdaClient Configuration Object</param>
public AmazonLambdaClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonLambdaConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
/// <summary>
/// Constructs AmazonLambdaClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
public AmazonLambdaClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonLambdaConfig())
{
}
/// <summary>
/// Constructs AmazonLambdaClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="region">The region to connect.</param>
public AmazonLambdaClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonLambdaConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonLambdaClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonLambdaClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="clientConfig">The AmazonLambdaClient Configuration Object</param>
public AmazonLambdaClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonLambdaConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
/// <summary>
/// Creates the signer for the service.
/// </summary>
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
/// <summary>
/// Capture metadata for the service.
/// </summary>
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
/// <summary>
/// Disposes the service client.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region AddLayerVersionPermission
/// <summary>
/// Adds permissions to the resource-based policy of a version of an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layer</a>. Use this action to grant layer usage permission to other accounts.
/// You can grant permission to a single account, all AWS accounts, or all accounts in
/// an organization.
///
///
/// <para>
/// To revoke permission, call <a>RemoveLayerVersionPermission</a> with the statement
/// ID that you specified when you added it.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddLayerVersionPermission service method.</param>
///
/// <returns>The response from the AddLayerVersionPermission service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PolicyLengthExceededException">
/// The permissions policy for the resource is too large. <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">Learn
/// more</a>
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PreconditionFailedException">
/// The RevisionId provided does not match the latest RevisionId for the Lambda function
/// or alias. Call the <code>GetFunction</code> or the <code>GetAlias</code> API to retrieve
/// the latest RevisionId for your resource.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddLayerVersionPermission">REST API Reference for AddLayerVersionPermission Operation</seealso>
public virtual AddLayerVersionPermissionResponse AddLayerVersionPermission(AddLayerVersionPermissionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddLayerVersionPermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddLayerVersionPermissionResponseUnmarshaller.Instance;
return Invoke<AddLayerVersionPermissionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the AddLayerVersionPermission operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the AddLayerVersionPermission operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndAddLayerVersionPermission
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddLayerVersionPermission">REST API Reference for AddLayerVersionPermission Operation</seealso>
public virtual IAsyncResult BeginAddLayerVersionPermission(AddLayerVersionPermissionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddLayerVersionPermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddLayerVersionPermissionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the AddLayerVersionPermission operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginAddLayerVersionPermission.</param>
///
/// <returns>Returns a AddLayerVersionPermissionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddLayerVersionPermission">REST API Reference for AddLayerVersionPermission Operation</seealso>
public virtual AddLayerVersionPermissionResponse EndAddLayerVersionPermission(IAsyncResult asyncResult)
{
return EndInvoke<AddLayerVersionPermissionResponse>(asyncResult);
}
#endregion
#region AddPermission
/// <summary>
/// Grants an AWS service or another account permission to use a function. You can apply
/// the policy at the function level, or specify a qualifier to restrict access to a single
/// version or alias. If you use a qualifier, the invoker must use the full Amazon Resource
/// Name (ARN) of that version or alias to invoke the function.
///
///
/// <para>
/// To grant permission to another account, specify the account ID as the <code>Principal</code>.
/// For AWS services, the principal is a domain-style identifier defined by the service,
/// like <code>s3.amazonaws.com</code> or <code>sns.amazonaws.com</code>. For AWS services,
/// you can also specify the ARN of the associated resource as the <code>SourceArn</code>.
/// If you grant permission to a service principal without specifying the source, other
/// accounts could potentially configure resources in their account to invoke your Lambda
/// function.
/// </para>
///
/// <para>
/// This action adds a statement to a resource-based permissions policy for the function.
/// For more information about function policies, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html">Lambda
/// Function Policies</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddPermission service method.</param>
///
/// <returns>The response from the AddPermission service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PolicyLengthExceededException">
/// The permissions policy for the resource is too large. <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">Learn
/// more</a>
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PreconditionFailedException">
/// The RevisionId provided does not match the latest RevisionId for the Lambda function
/// or alias. Call the <code>GetFunction</code> or the <code>GetAlias</code> API to retrieve
/// the latest RevisionId for your resource.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddPermission">REST API Reference for AddPermission Operation</seealso>
public virtual AddPermissionResponse AddPermission(AddPermissionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddPermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddPermissionResponseUnmarshaller.Instance;
return Invoke<AddPermissionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the AddPermission operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the AddPermission operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndAddPermission
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddPermission">REST API Reference for AddPermission Operation</seealso>
public virtual IAsyncResult BeginAddPermission(AddPermissionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddPermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddPermissionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the AddPermission operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginAddPermission.</param>
///
/// <returns>Returns a AddPermissionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddPermission">REST API Reference for AddPermission Operation</seealso>
public virtual AddPermissionResponse EndAddPermission(IAsyncResult asyncResult)
{
return EndInvoke<AddPermissionResponse>(asyncResult);
}
#endregion
#region CreateAlias
/// <summary>
/// Creates an <a href="https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">alias</a>
/// for a Lambda function version. Use aliases to provide clients with a function identifier
/// that you can update to invoke a different version.
///
///
/// <para>
/// You can also map an alias to split invocation requests between two versions. Use the
/// <code>RoutingConfig</code> parameter to specify a second version and the percentage
/// of invocation requests that it receives.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateAlias service method.</param>
///
/// <returns>The response from the CreateAlias service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateAlias">REST API Reference for CreateAlias Operation</seealso>
public virtual CreateAliasResponse CreateAlias(CreateAliasRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateAliasRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateAliasResponseUnmarshaller.Instance;
return Invoke<CreateAliasResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateAlias operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateAlias operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateAlias
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateAlias">REST API Reference for CreateAlias Operation</seealso>
public virtual IAsyncResult BeginCreateAlias(CreateAliasRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateAliasRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateAliasResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateAlias operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateAlias.</param>
///
/// <returns>Returns a CreateAliasResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateAlias">REST API Reference for CreateAlias Operation</seealso>
public virtual CreateAliasResponse EndCreateAlias(IAsyncResult asyncResult)
{
return EndInvoke<CreateAliasResponse>(asyncResult);
}
#endregion
#region CreateEventSourceMapping
/// <summary>
/// Creates a mapping between an event source and an AWS Lambda function. Lambda reads
/// items from the event source and triggers the function.
///
///
/// <para>
/// For details about each event source type, see the following topics.
/// </para>
/// <ul> <li>
/// <para>
/// <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html">Using AWS Lambda
/// with Amazon DynamoDB</a>
/// </para>
/// </li> <li>
/// <para>
/// <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html">Using AWS
/// Lambda with Amazon Kinesis</a>
/// </para>
/// </li> <li>
/// <para>
/// <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html">Using AWS Lambda
/// with Amazon SQS</a>
/// </para>
/// </li> <li>
/// <para>
/// <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html">Using AWS Lambda
/// with Amazon MSK</a>
/// </para>
/// </li> </ul>
/// <para>
/// The following error handling options are only available for stream sources (DynamoDB
/// and Kinesis):
/// </para>
/// <ul> <li>
/// <para>
/// <code>BisectBatchOnFunctionError</code> - If the function returns an error, split
/// the batch in two and retry.
/// </para>
/// </li> <li>
/// <para>
/// <code>DestinationConfig</code> - Send discarded records to an Amazon SQS queue or
/// Amazon SNS topic.
/// </para>
/// </li> <li>
/// <para>
/// <code>MaximumRecordAgeInSeconds</code> - Discard records older than the specified
/// age. Default -1 (infinite). Minimum 60. Maximum 604800.
/// </para>
/// </li> <li>
/// <para>
/// <code>MaximumRetryAttempts</code> - Discard records after the specified number of
/// retries. Default -1 (infinite). Minimum 0. Maximum 10000. When infinite, failed records
/// will be retried until the record expires.
/// </para>
/// </li> <li>
/// <para>
/// <code>ParallelizationFactor</code> - Process multiple batches from each shard concurrently.
/// </para>
/// </li> </ul>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateEventSourceMapping service method.</param>
///
/// <returns>The response from the CreateEventSourceMapping service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateEventSourceMapping">REST API Reference for CreateEventSourceMapping Operation</seealso>
public virtual CreateEventSourceMappingResponse CreateEventSourceMapping(CreateEventSourceMappingRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateEventSourceMappingRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateEventSourceMappingResponseUnmarshaller.Instance;
return Invoke<CreateEventSourceMappingResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateEventSourceMapping operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateEventSourceMapping operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateEventSourceMapping
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateEventSourceMapping">REST API Reference for CreateEventSourceMapping Operation</seealso>
public virtual IAsyncResult BeginCreateEventSourceMapping(CreateEventSourceMappingRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateEventSourceMappingRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateEventSourceMappingResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateEventSourceMapping operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateEventSourceMapping.</param>
///
/// <returns>Returns a CreateEventSourceMappingResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateEventSourceMapping">REST API Reference for CreateEventSourceMapping Operation</seealso>
public virtual CreateEventSourceMappingResponse EndCreateEventSourceMapping(IAsyncResult asyncResult)
{
return EndInvoke<CreateEventSourceMappingResponse>(asyncResult);
}
#endregion
#region CreateFunction
/// <summary>
/// Creates a Lambda function. To create a function, you need a <a href="https://docs.aws.amazon.com/lambda/latest/dg/deployment-package-v2.html">deployment
/// package</a> and an <a href="https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role">execution
/// role</a>. The deployment package contains your function code. The execution role grants
/// the function permission to use AWS services, such as Amazon CloudWatch Logs for log
/// streaming and AWS X-Ray for request tracing.
///
///
/// <para>
/// When you create a function, Lambda provisions an instance of the function and its
/// supporting resources. If your function connects to a VPC, this process can take a
/// minute or so. During this time, you can't invoke or modify the function. The <code>State</code>,
/// <code>StateReason</code>, and <code>StateReasonCode</code> fields in the response
/// from <a>GetFunctionConfiguration</a> indicate when the function is ready to invoke.
/// For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/functions-states.html">Function
/// States</a>.
/// </para>
///
/// <para>
/// A function has an unpublished version, and can have published versions and aliases.
/// The unpublished version changes when you update your function's code and configuration.
/// A published version is a snapshot of your function code and configuration that can't
/// be changed. An alias is a named resource that maps to a version, and can be changed
/// to map to a different version. Use the <code>Publish</code> parameter to create version
/// <code>1</code> of your function from its initial configuration.
/// </para>
///
/// <para>
/// The other parameters let you configure version-specific and function-level settings.
/// You can modify version-specific settings later with <a>UpdateFunctionConfiguration</a>.
/// Function-level settings apply to both the unpublished and published versions of the
/// function, and include tags (<a>TagResource</a>) and per-function concurrency limits
/// (<a>PutFunctionConcurrency</a>).
/// </para>
///
/// <para>
/// If another account or an AWS service invokes your function, use <a>AddPermission</a>
/// to grant permission by creating a resource-based IAM policy. You can grant permissions
/// at the function level, on a version, or on an alias.
/// </para>
///
/// <para>
/// To invoke your function directly, use <a>Invoke</a>. To invoke your function in response
/// to events in other AWS services, create an event source mapping (<a>CreateEventSourceMapping</a>),
/// or configure a function trigger in the other service. For more information, see <a
/// href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-invocation.html">Invoking
/// Functions</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateFunction service method.</param>
///
/// <returns>The response from the CreateFunction service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.CodeStorageExceededException">
/// You have exceeded your maximum total code size per account. <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">Learn
/// more</a>
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateFunction">REST API Reference for CreateFunction Operation</seealso>
public virtual CreateFunctionResponse CreateFunction(CreateFunctionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateFunctionRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateFunctionResponseUnmarshaller.Instance;
return Invoke<CreateFunctionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateFunction operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateFunction operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateFunction
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateFunction">REST API Reference for CreateFunction Operation</seealso>
public virtual IAsyncResult BeginCreateFunction(CreateFunctionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateFunctionRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateFunctionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateFunction operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateFunction.</param>
///
/// <returns>Returns a CreateFunctionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateFunction">REST API Reference for CreateFunction Operation</seealso>
public virtual CreateFunctionResponse EndCreateFunction(IAsyncResult asyncResult)
{
return EndInvoke<CreateFunctionResponse>(asyncResult);
}
#endregion
#region DeleteAlias
/// <summary>
/// Deletes a Lambda function <a href="https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">alias</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteAlias service method.</param>
///
/// <returns>The response from the DeleteAlias service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteAlias">REST API Reference for DeleteAlias Operation</seealso>
public virtual DeleteAliasResponse DeleteAlias(DeleteAliasRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteAliasRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteAliasResponseUnmarshaller.Instance;
return Invoke<DeleteAliasResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteAlias operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteAlias operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteAlias
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteAlias">REST API Reference for DeleteAlias Operation</seealso>
public virtual IAsyncResult BeginDeleteAlias(DeleteAliasRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteAliasRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteAliasResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteAlias operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteAlias.</param>
///
/// <returns>Returns a DeleteAliasResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteAlias">REST API Reference for DeleteAlias Operation</seealso>
public virtual DeleteAliasResponse EndDeleteAlias(IAsyncResult asyncResult)
{
return EndInvoke<DeleteAliasResponse>(asyncResult);
}
#endregion
#region DeleteEventSourceMapping
/// <summary>
/// Deletes an <a href="https://docs.aws.amazon.com/lambda/latest/dg/intro-invocation-modes.html">event
/// source mapping</a>. You can get the identifier of a mapping from the output of <a>ListEventSourceMappings</a>.
///
///
/// <para>
/// When you delete an event source mapping, it enters a <code>Deleting</code> state and
/// might not be completely deleted for several seconds.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteEventSourceMapping service method.</param>
///
/// <returns>The response from the DeleteEventSourceMapping service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceInUseException">
/// The operation conflicts with the resource's availability. For example, you attempted
/// to update an EventSource Mapping in CREATING, or tried to delete a EventSource mapping
/// currently in the UPDATING state.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteEventSourceMapping">REST API Reference for DeleteEventSourceMapping Operation</seealso>
public virtual DeleteEventSourceMappingResponse DeleteEventSourceMapping(DeleteEventSourceMappingRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteEventSourceMappingRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteEventSourceMappingResponseUnmarshaller.Instance;
return Invoke<DeleteEventSourceMappingResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteEventSourceMapping operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteEventSourceMapping operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteEventSourceMapping
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteEventSourceMapping">REST API Reference for DeleteEventSourceMapping Operation</seealso>
public virtual IAsyncResult BeginDeleteEventSourceMapping(DeleteEventSourceMappingRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteEventSourceMappingRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteEventSourceMappingResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteEventSourceMapping operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteEventSourceMapping.</param>
///
/// <returns>Returns a DeleteEventSourceMappingResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteEventSourceMapping">REST API Reference for DeleteEventSourceMapping Operation</seealso>
public virtual DeleteEventSourceMappingResponse EndDeleteEventSourceMapping(IAsyncResult asyncResult)
{
return EndInvoke<DeleteEventSourceMappingResponse>(asyncResult);
}
#endregion
#region DeleteFunction
/// <summary>
/// Deletes a Lambda function. To delete a specific function version, use the <code>Qualifier</code>
/// parameter. Otherwise, all versions and aliases are deleted.
///
///
/// <para>
/// To delete Lambda event source mappings that invoke a function, use <a>DeleteEventSourceMapping</a>.
/// For AWS services and resources that invoke your function directly, delete the trigger
/// in the service where you originally configured it.
/// </para>
/// </summary>
/// <param name="functionName">The name of the Lambda function or version. <p class="title"> <b>Name formats</b> <ul> <li> <b>Function name</b> - <code>my-function</code> (name-only), <code>my-function:1</code> (with version). </li> <li> <b>Function ARN</b> - <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>. </li> <li> <b>Partial ARN</b> - <code>123456789012:function:my-function</code>. </li> </ul> You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</param>
///
/// <returns>The response from the DeleteFunction service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunction">REST API Reference for DeleteFunction Operation</seealso>
public virtual DeleteFunctionResponse DeleteFunction(string functionName)
{
var request = new DeleteFunctionRequest();
request.FunctionName = functionName;
return DeleteFunction(request);
}
/// <summary>
/// Deletes a Lambda function. To delete a specific function version, use the <code>Qualifier</code>
/// parameter. Otherwise, all versions and aliases are deleted.
///
///
/// <para>
/// To delete Lambda event source mappings that invoke a function, use <a>DeleteEventSourceMapping</a>.
/// For AWS services and resources that invoke your function directly, delete the trigger
/// in the service where you originally configured it.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteFunction service method.</param>
///
/// <returns>The response from the DeleteFunction service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunction">REST API Reference for DeleteFunction Operation</seealso>
public virtual DeleteFunctionResponse DeleteFunction(DeleteFunctionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteFunctionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteFunctionResponseUnmarshaller.Instance;
return Invoke<DeleteFunctionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteFunction operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteFunction operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteFunction
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunction">REST API Reference for DeleteFunction Operation</seealso>
public virtual IAsyncResult BeginDeleteFunction(DeleteFunctionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteFunctionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteFunctionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteFunction operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteFunction.</param>
///
/// <returns>Returns a DeleteFunctionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunction">REST API Reference for DeleteFunction Operation</seealso>
public virtual DeleteFunctionResponse EndDeleteFunction(IAsyncResult asyncResult)
{
return EndInvoke<DeleteFunctionResponse>(asyncResult);
}
#endregion
#region DeleteFunctionConcurrency
/// <summary>
/// Removes a concurrent execution limit from a function.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteFunctionConcurrency service method.</param>
///
/// <returns>The response from the DeleteFunctionConcurrency service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionConcurrency">REST API Reference for DeleteFunctionConcurrency Operation</seealso>
public virtual DeleteFunctionConcurrencyResponse DeleteFunctionConcurrency(DeleteFunctionConcurrencyRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteFunctionConcurrencyRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteFunctionConcurrencyResponseUnmarshaller.Instance;
return Invoke<DeleteFunctionConcurrencyResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteFunctionConcurrency operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteFunctionConcurrency operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteFunctionConcurrency
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionConcurrency">REST API Reference for DeleteFunctionConcurrency Operation</seealso>
public virtual IAsyncResult BeginDeleteFunctionConcurrency(DeleteFunctionConcurrencyRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteFunctionConcurrencyRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteFunctionConcurrencyResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteFunctionConcurrency operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteFunctionConcurrency.</param>
///
/// <returns>Returns a DeleteFunctionConcurrencyResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionConcurrency">REST API Reference for DeleteFunctionConcurrency Operation</seealso>
public virtual DeleteFunctionConcurrencyResponse EndDeleteFunctionConcurrency(IAsyncResult asyncResult)
{
return EndInvoke<DeleteFunctionConcurrencyResponse>(asyncResult);
}
#endregion
#region DeleteFunctionEventInvokeConfig
/// <summary>
/// Deletes the configuration for asynchronous invocation for a function, version, or
/// alias.
///
///
/// <para>
/// To configure options for asynchronous invocation, use <a>PutFunctionEventInvokeConfig</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteFunctionEventInvokeConfig service method.</param>
///
/// <returns>The response from the DeleteFunctionEventInvokeConfig service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionEventInvokeConfig">REST API Reference for DeleteFunctionEventInvokeConfig Operation</seealso>
public virtual DeleteFunctionEventInvokeConfigResponse DeleteFunctionEventInvokeConfig(DeleteFunctionEventInvokeConfigRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteFunctionEventInvokeConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteFunctionEventInvokeConfigResponseUnmarshaller.Instance;
return Invoke<DeleteFunctionEventInvokeConfigResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteFunctionEventInvokeConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteFunctionEventInvokeConfig operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteFunctionEventInvokeConfig
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionEventInvokeConfig">REST API Reference for DeleteFunctionEventInvokeConfig Operation</seealso>
public virtual IAsyncResult BeginDeleteFunctionEventInvokeConfig(DeleteFunctionEventInvokeConfigRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteFunctionEventInvokeConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteFunctionEventInvokeConfigResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteFunctionEventInvokeConfig operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteFunctionEventInvokeConfig.</param>
///
/// <returns>Returns a DeleteFunctionEventInvokeConfigResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionEventInvokeConfig">REST API Reference for DeleteFunctionEventInvokeConfig Operation</seealso>
public virtual DeleteFunctionEventInvokeConfigResponse EndDeleteFunctionEventInvokeConfig(IAsyncResult asyncResult)
{
return EndInvoke<DeleteFunctionEventInvokeConfigResponse>(asyncResult);
}
#endregion
#region DeleteLayerVersion
/// <summary>
/// Deletes a version of an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layer</a>. Deleted versions can no longer be viewed or added to functions.
/// To avoid breaking functions, a copy of the version remains in Lambda until no functions
/// refer to it.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteLayerVersion service method.</param>
///
/// <returns>The response from the DeleteLayerVersion service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteLayerVersion">REST API Reference for DeleteLayerVersion Operation</seealso>
public virtual DeleteLayerVersionResponse DeleteLayerVersion(DeleteLayerVersionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteLayerVersionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteLayerVersionResponseUnmarshaller.Instance;
return Invoke<DeleteLayerVersionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteLayerVersion operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteLayerVersion operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteLayerVersion
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteLayerVersion">REST API Reference for DeleteLayerVersion Operation</seealso>
public virtual IAsyncResult BeginDeleteLayerVersion(DeleteLayerVersionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteLayerVersionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteLayerVersionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteLayerVersion operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteLayerVersion.</param>
///
/// <returns>Returns a DeleteLayerVersionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteLayerVersion">REST API Reference for DeleteLayerVersion Operation</seealso>
public virtual DeleteLayerVersionResponse EndDeleteLayerVersion(IAsyncResult asyncResult)
{
return EndInvoke<DeleteLayerVersionResponse>(asyncResult);
}
#endregion
#region DeleteProvisionedConcurrencyConfig
/// <summary>
/// Deletes the provisioned concurrency configuration for a function.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteProvisionedConcurrencyConfig service method.</param>
///
/// <returns>The response from the DeleteProvisionedConcurrencyConfig service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteProvisionedConcurrencyConfig">REST API Reference for DeleteProvisionedConcurrencyConfig Operation</seealso>
public virtual DeleteProvisionedConcurrencyConfigResponse DeleteProvisionedConcurrencyConfig(DeleteProvisionedConcurrencyConfigRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteProvisionedConcurrencyConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteProvisionedConcurrencyConfigResponseUnmarshaller.Instance;
return Invoke<DeleteProvisionedConcurrencyConfigResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteProvisionedConcurrencyConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteProvisionedConcurrencyConfig operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteProvisionedConcurrencyConfig
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteProvisionedConcurrencyConfig">REST API Reference for DeleteProvisionedConcurrencyConfig Operation</seealso>
public virtual IAsyncResult BeginDeleteProvisionedConcurrencyConfig(DeleteProvisionedConcurrencyConfigRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteProvisionedConcurrencyConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteProvisionedConcurrencyConfigResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteProvisionedConcurrencyConfig operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteProvisionedConcurrencyConfig.</param>
///
/// <returns>Returns a DeleteProvisionedConcurrencyConfigResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteProvisionedConcurrencyConfig">REST API Reference for DeleteProvisionedConcurrencyConfig Operation</seealso>
public virtual DeleteProvisionedConcurrencyConfigResponse EndDeleteProvisionedConcurrencyConfig(IAsyncResult asyncResult)
{
return EndInvoke<DeleteProvisionedConcurrencyConfigResponse>(asyncResult);
}
#endregion
#region GetAccountSettings
/// <summary>
/// Retrieves details about your account's <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">limits</a>
/// and usage in an AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetAccountSettings service method.</param>
///
/// <returns>The response from the GetAccountSettings service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAccountSettings">REST API Reference for GetAccountSettings Operation</seealso>
public virtual GetAccountSettingsResponse GetAccountSettings(GetAccountSettingsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetAccountSettingsRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetAccountSettingsResponseUnmarshaller.Instance;
return Invoke<GetAccountSettingsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetAccountSettings operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetAccountSettings operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetAccountSettings
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAccountSettings">REST API Reference for GetAccountSettings Operation</seealso>
public virtual IAsyncResult BeginGetAccountSettings(GetAccountSettingsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetAccountSettingsRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetAccountSettingsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetAccountSettings operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetAccountSettings.</param>
///
/// <returns>Returns a GetAccountSettingsResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAccountSettings">REST API Reference for GetAccountSettings Operation</seealso>
public virtual GetAccountSettingsResponse EndGetAccountSettings(IAsyncResult asyncResult)
{
return EndInvoke<GetAccountSettingsResponse>(asyncResult);
}
#endregion
#region GetAlias
/// <summary>
/// Returns details about a Lambda function <a href="https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">alias</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetAlias service method.</param>
///
/// <returns>The response from the GetAlias service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAlias">REST API Reference for GetAlias Operation</seealso>
public virtual GetAliasResponse GetAlias(GetAliasRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetAliasRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetAliasResponseUnmarshaller.Instance;
return Invoke<GetAliasResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetAlias operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetAlias operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetAlias
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAlias">REST API Reference for GetAlias Operation</seealso>
public virtual IAsyncResult BeginGetAlias(GetAliasRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetAliasRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetAliasResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetAlias operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetAlias.</param>
///
/// <returns>Returns a GetAliasResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAlias">REST API Reference for GetAlias Operation</seealso>
public virtual GetAliasResponse EndGetAlias(IAsyncResult asyncResult)
{
return EndInvoke<GetAliasResponse>(asyncResult);
}
#endregion
#region GetEventSourceMapping
/// <summary>
/// Returns details about an event source mapping. You can get the identifier of a mapping
/// from the output of <a>ListEventSourceMappings</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetEventSourceMapping service method.</param>
///
/// <returns>The response from the GetEventSourceMapping service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetEventSourceMapping">REST API Reference for GetEventSourceMapping Operation</seealso>
public virtual GetEventSourceMappingResponse GetEventSourceMapping(GetEventSourceMappingRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetEventSourceMappingRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetEventSourceMappingResponseUnmarshaller.Instance;
return Invoke<GetEventSourceMappingResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetEventSourceMapping operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetEventSourceMapping operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetEventSourceMapping
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetEventSourceMapping">REST API Reference for GetEventSourceMapping Operation</seealso>
public virtual IAsyncResult BeginGetEventSourceMapping(GetEventSourceMappingRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetEventSourceMappingRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetEventSourceMappingResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetEventSourceMapping operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetEventSourceMapping.</param>
///
/// <returns>Returns a GetEventSourceMappingResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetEventSourceMapping">REST API Reference for GetEventSourceMapping Operation</seealso>
public virtual GetEventSourceMappingResponse EndGetEventSourceMapping(IAsyncResult asyncResult)
{
return EndInvoke<GetEventSourceMappingResponse>(asyncResult);
}
#endregion
#region GetFunction
/// <summary>
/// Returns information about the function or function version, with a link to download
/// the deployment package that's valid for 10 minutes. If you specify a function version,
/// only details that are specific to that version are returned.
/// </summary>
/// <param name="functionName">The name of the Lambda function, version, or alias. <p class="title"> <b>Name formats</b> <ul> <li> <b>Function name</b> - <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias). </li> <li> <b>Function ARN</b> - <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>. </li> <li> <b>Partial ARN</b> - <code>123456789012:function:my-function</code>. </li> </ul> You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</param>
///
/// <returns>The response from the GetFunction service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunction">REST API Reference for GetFunction Operation</seealso>
public virtual GetFunctionResponse GetFunction(string functionName)
{
var request = new GetFunctionRequest();
request.FunctionName = functionName;
return GetFunction(request);
}
/// <summary>
/// Returns information about the function or function version, with a link to download
/// the deployment package that's valid for 10 minutes. If you specify a function version,
/// only details that are specific to that version are returned.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetFunction service method.</param>
///
/// <returns>The response from the GetFunction service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunction">REST API Reference for GetFunction Operation</seealso>
public virtual GetFunctionResponse GetFunction(GetFunctionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetFunctionRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetFunctionResponseUnmarshaller.Instance;
return Invoke<GetFunctionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetFunction operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetFunction operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetFunction
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunction">REST API Reference for GetFunction Operation</seealso>
public virtual IAsyncResult BeginGetFunction(GetFunctionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetFunctionRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetFunctionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetFunction operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetFunction.</param>
///
/// <returns>Returns a GetFunctionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunction">REST API Reference for GetFunction Operation</seealso>
public virtual GetFunctionResponse EndGetFunction(IAsyncResult asyncResult)
{
return EndInvoke<GetFunctionResponse>(asyncResult);
}
#endregion
#region GetFunctionConcurrency
/// <summary>
/// Returns details about the reserved concurrency configuration for a function. To set
/// a concurrency limit for a function, use <a>PutFunctionConcurrency</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetFunctionConcurrency service method.</param>
///
/// <returns>The response from the GetFunctionConcurrency service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConcurrency">REST API Reference for GetFunctionConcurrency Operation</seealso>
public virtual GetFunctionConcurrencyResponse GetFunctionConcurrency(GetFunctionConcurrencyRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetFunctionConcurrencyRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetFunctionConcurrencyResponseUnmarshaller.Instance;
return Invoke<GetFunctionConcurrencyResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetFunctionConcurrency operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetFunctionConcurrency operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetFunctionConcurrency
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConcurrency">REST API Reference for GetFunctionConcurrency Operation</seealso>
public virtual IAsyncResult BeginGetFunctionConcurrency(GetFunctionConcurrencyRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetFunctionConcurrencyRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetFunctionConcurrencyResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetFunctionConcurrency operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetFunctionConcurrency.</param>
///
/// <returns>Returns a GetFunctionConcurrencyResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConcurrency">REST API Reference for GetFunctionConcurrency Operation</seealso>
public virtual GetFunctionConcurrencyResponse EndGetFunctionConcurrency(IAsyncResult asyncResult)
{
return EndInvoke<GetFunctionConcurrencyResponse>(asyncResult);
}
#endregion
#region GetFunctionConfiguration
/// <summary>
/// Returns the version-specific settings of a Lambda function or version. The output
/// includes only options that can vary between versions of a function. To modify these
/// settings, use <a>UpdateFunctionConfiguration</a>.
///
///
/// <para>
/// To get all of a function's details, including function-level settings, use <a>GetFunction</a>.
/// </para>
/// </summary>
/// <param name="functionName">The name of the Lambda function, version, or alias. <p class="title"> <b>Name formats</b> <ul> <li> <b>Function name</b> - <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias). </li> <li> <b>Function ARN</b> - <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>. </li> <li> <b>Partial ARN</b> - <code>123456789012:function:my-function</code>. </li> </ul> You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</param>
///
/// <returns>The response from the GetFunctionConfiguration service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConfiguration">REST API Reference for GetFunctionConfiguration Operation</seealso>
public virtual GetFunctionConfigurationResponse GetFunctionConfiguration(string functionName)
{
var request = new GetFunctionConfigurationRequest();
request.FunctionName = functionName;
return GetFunctionConfiguration(request);
}
/// <summary>
/// Returns the version-specific settings of a Lambda function or version. The output
/// includes only options that can vary between versions of a function. To modify these
/// settings, use <a>UpdateFunctionConfiguration</a>.
///
///
/// <para>
/// To get all of a function's details, including function-level settings, use <a>GetFunction</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetFunctionConfiguration service method.</param>
///
/// <returns>The response from the GetFunctionConfiguration service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConfiguration">REST API Reference for GetFunctionConfiguration Operation</seealso>
public virtual GetFunctionConfigurationResponse GetFunctionConfiguration(GetFunctionConfigurationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetFunctionConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetFunctionConfigurationResponseUnmarshaller.Instance;
return Invoke<GetFunctionConfigurationResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetFunctionConfiguration operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetFunctionConfiguration operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetFunctionConfiguration
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConfiguration">REST API Reference for GetFunctionConfiguration Operation</seealso>
public virtual IAsyncResult BeginGetFunctionConfiguration(GetFunctionConfigurationRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetFunctionConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetFunctionConfigurationResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetFunctionConfiguration operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetFunctionConfiguration.</param>
///
/// <returns>Returns a GetFunctionConfigurationResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConfiguration">REST API Reference for GetFunctionConfiguration Operation</seealso>
public virtual GetFunctionConfigurationResponse EndGetFunctionConfiguration(IAsyncResult asyncResult)
{
return EndInvoke<GetFunctionConfigurationResponse>(asyncResult);
}
#endregion
#region GetFunctionEventInvokeConfig
/// <summary>
/// Retrieves the configuration for asynchronous invocation for a function, version, or
/// alias.
///
///
/// <para>
/// To configure options for asynchronous invocation, use <a>PutFunctionEventInvokeConfig</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetFunctionEventInvokeConfig service method.</param>
///
/// <returns>The response from the GetFunctionEventInvokeConfig service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionEventInvokeConfig">REST API Reference for GetFunctionEventInvokeConfig Operation</seealso>
public virtual GetFunctionEventInvokeConfigResponse GetFunctionEventInvokeConfig(GetFunctionEventInvokeConfigRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetFunctionEventInvokeConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetFunctionEventInvokeConfigResponseUnmarshaller.Instance;
return Invoke<GetFunctionEventInvokeConfigResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetFunctionEventInvokeConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetFunctionEventInvokeConfig operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetFunctionEventInvokeConfig
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionEventInvokeConfig">REST API Reference for GetFunctionEventInvokeConfig Operation</seealso>
public virtual IAsyncResult BeginGetFunctionEventInvokeConfig(GetFunctionEventInvokeConfigRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetFunctionEventInvokeConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetFunctionEventInvokeConfigResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetFunctionEventInvokeConfig operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetFunctionEventInvokeConfig.</param>
///
/// <returns>Returns a GetFunctionEventInvokeConfigResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionEventInvokeConfig">REST API Reference for GetFunctionEventInvokeConfig Operation</seealso>
public virtual GetFunctionEventInvokeConfigResponse EndGetFunctionEventInvokeConfig(IAsyncResult asyncResult)
{
return EndInvoke<GetFunctionEventInvokeConfigResponse>(asyncResult);
}
#endregion
#region GetLayerVersion
/// <summary>
/// Returns information about a version of an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layer</a>, with a link to download the layer archive that's valid for 10 minutes.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetLayerVersion service method.</param>
///
/// <returns>The response from the GetLayerVersion service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersion">REST API Reference for GetLayerVersion Operation</seealso>
public virtual GetLayerVersionResponse GetLayerVersion(GetLayerVersionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetLayerVersionRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetLayerVersionResponseUnmarshaller.Instance;
return Invoke<GetLayerVersionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetLayerVersion operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetLayerVersion operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetLayerVersion
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersion">REST API Reference for GetLayerVersion Operation</seealso>
public virtual IAsyncResult BeginGetLayerVersion(GetLayerVersionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetLayerVersionRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetLayerVersionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetLayerVersion operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetLayerVersion.</param>
///
/// <returns>Returns a GetLayerVersionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersion">REST API Reference for GetLayerVersion Operation</seealso>
public virtual GetLayerVersionResponse EndGetLayerVersion(IAsyncResult asyncResult)
{
return EndInvoke<GetLayerVersionResponse>(asyncResult);
}
#endregion
#region GetLayerVersionByArn
/// <summary>
/// Returns information about a version of an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layer</a>, with a link to download the layer archive that's valid for 10 minutes.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetLayerVersionByArn service method.</param>
///
/// <returns>The response from the GetLayerVersionByArn service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersionByArn">REST API Reference for GetLayerVersionByArn Operation</seealso>
public virtual GetLayerVersionByArnResponse GetLayerVersionByArn(GetLayerVersionByArnRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetLayerVersionByArnRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetLayerVersionByArnResponseUnmarshaller.Instance;
return Invoke<GetLayerVersionByArnResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetLayerVersionByArn operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetLayerVersionByArn operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetLayerVersionByArn
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersionByArn">REST API Reference for GetLayerVersionByArn Operation</seealso>
public virtual IAsyncResult BeginGetLayerVersionByArn(GetLayerVersionByArnRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetLayerVersionByArnRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetLayerVersionByArnResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetLayerVersionByArn operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetLayerVersionByArn.</param>
///
/// <returns>Returns a GetLayerVersionByArnResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersionByArn">REST API Reference for GetLayerVersionByArn Operation</seealso>
public virtual GetLayerVersionByArnResponse EndGetLayerVersionByArn(IAsyncResult asyncResult)
{
return EndInvoke<GetLayerVersionByArnResponse>(asyncResult);
}
#endregion
#region GetLayerVersionPolicy
/// <summary>
/// Returns the permission policy for a version of an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layer</a>. For more information, see <a>AddLayerVersionPermission</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetLayerVersionPolicy service method.</param>
///
/// <returns>The response from the GetLayerVersionPolicy service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersionPolicy">REST API Reference for GetLayerVersionPolicy Operation</seealso>
public virtual GetLayerVersionPolicyResponse GetLayerVersionPolicy(GetLayerVersionPolicyRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetLayerVersionPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetLayerVersionPolicyResponseUnmarshaller.Instance;
return Invoke<GetLayerVersionPolicyResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetLayerVersionPolicy operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetLayerVersionPolicy operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetLayerVersionPolicy
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersionPolicy">REST API Reference for GetLayerVersionPolicy Operation</seealso>
public virtual IAsyncResult BeginGetLayerVersionPolicy(GetLayerVersionPolicyRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetLayerVersionPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetLayerVersionPolicyResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetLayerVersionPolicy operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetLayerVersionPolicy.</param>
///
/// <returns>Returns a GetLayerVersionPolicyResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetLayerVersionPolicy">REST API Reference for GetLayerVersionPolicy Operation</seealso>
public virtual GetLayerVersionPolicyResponse EndGetLayerVersionPolicy(IAsyncResult asyncResult)
{
return EndInvoke<GetLayerVersionPolicyResponse>(asyncResult);
}
#endregion
#region GetPolicy
/// <summary>
/// Returns the <a href="https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html">resource-based
/// IAM policy</a> for a function, version, or alias.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetPolicy service method.</param>
///
/// <returns>The response from the GetPolicy service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetPolicy">REST API Reference for GetPolicy Operation</seealso>
public virtual GetPolicyResponse GetPolicy(GetPolicyRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetPolicyResponseUnmarshaller.Instance;
return Invoke<GetPolicyResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetPolicy operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetPolicy operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetPolicy
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetPolicy">REST API Reference for GetPolicy Operation</seealso>
public virtual IAsyncResult BeginGetPolicy(GetPolicyRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetPolicyRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetPolicyResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetPolicy operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetPolicy.</param>
///
/// <returns>Returns a GetPolicyResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetPolicy">REST API Reference for GetPolicy Operation</seealso>
public virtual GetPolicyResponse EndGetPolicy(IAsyncResult asyncResult)
{
return EndInvoke<GetPolicyResponse>(asyncResult);
}
#endregion
#region GetProvisionedConcurrencyConfig
/// <summary>
/// Retrieves the provisioned concurrency configuration for a function's alias or version.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetProvisionedConcurrencyConfig service method.</param>
///
/// <returns>The response from the GetProvisionedConcurrencyConfig service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ProvisionedConcurrencyConfigNotFoundException">
/// The specified configuration does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetProvisionedConcurrencyConfig">REST API Reference for GetProvisionedConcurrencyConfig Operation</seealso>
public virtual GetProvisionedConcurrencyConfigResponse GetProvisionedConcurrencyConfig(GetProvisionedConcurrencyConfigRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetProvisionedConcurrencyConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetProvisionedConcurrencyConfigResponseUnmarshaller.Instance;
return Invoke<GetProvisionedConcurrencyConfigResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the GetProvisionedConcurrencyConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetProvisionedConcurrencyConfig operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetProvisionedConcurrencyConfig
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetProvisionedConcurrencyConfig">REST API Reference for GetProvisionedConcurrencyConfig Operation</seealso>
public virtual IAsyncResult BeginGetProvisionedConcurrencyConfig(GetProvisionedConcurrencyConfigRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetProvisionedConcurrencyConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetProvisionedConcurrencyConfigResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the GetProvisionedConcurrencyConfig operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetProvisionedConcurrencyConfig.</param>
///
/// <returns>Returns a GetProvisionedConcurrencyConfigResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetProvisionedConcurrencyConfig">REST API Reference for GetProvisionedConcurrencyConfig Operation</seealso>
public virtual GetProvisionedConcurrencyConfigResponse EndGetProvisionedConcurrencyConfig(IAsyncResult asyncResult)
{
return EndInvoke<GetProvisionedConcurrencyConfigResponse>(asyncResult);
}
#endregion
#region Invoke
/// <summary>
/// Invokes a Lambda function. You can invoke a function synchronously (and wait for the
/// response), or asynchronously. To invoke a function asynchronously, set <code>InvocationType</code>
/// to <code>Event</code>.
///
///
/// <para>
/// For <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-sync.html">synchronous
/// invocation</a>, details about the function response, including errors, are included
/// in the response body and headers. For either invocation type, you can find more information
/// in the <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions.html">execution
/// log</a> and <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html">trace</a>.
/// </para>
///
/// <para>
/// When an error occurs, your function may be invoked multiple times. Retry behavior
/// varies by error type, client, event source, and invocation type. For example, if you
/// invoke a function asynchronously and it returns an error, Lambda executes the function
/// up to two more times. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/retries-on-errors.html">Retry
/// Behavior</a>.
/// </para>
///
/// <para>
/// For <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html">asynchronous
/// invocation</a>, Lambda adds events to a queue before sending them to your function.
/// If your function does not have enough capacity to keep up with the queue, events may
/// be lost. Occasionally, your function may receive the same event multiple times, even
/// if no error occurs. To retain events that were not processed, configure your function
/// with a <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#dlq">dead-letter
/// queue</a>.
/// </para>
///
/// <para>
/// The status code in the API response doesn't reflect function errors. Error codes are
/// reserved for errors that prevent your function from executing, such as permissions
/// errors, <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">limit errors</a>,
/// or issues with your function's code and configuration. For example, Lambda returns
/// <code>TooManyRequestsException</code> if executing the function would cause you to
/// exceed a concurrency limit at either the account level (<code>ConcurrentInvocationLimitExceeded</code>)
/// or function level (<code>ReservedFunctionConcurrentInvocationLimitExceeded</code>).
/// </para>
///
/// <para>
/// For functions with a long timeout, your client might be disconnected during synchronous
/// invocation while it waits for a response. Configure your HTTP client, SDK, firewall,
/// proxy, or operating system to allow for long connections with timeout or keep-alive
/// settings.
/// </para>
///
/// <para>
/// This operation requires permission for the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awslambda.html">lambda:InvokeFunction</a>
/// action.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the Invoke service method.</param>
///
/// <returns>The response from the Invoke service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.EC2AccessDeniedException">
/// Need additional permissions to configure VPC settings.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.EC2ThrottledException">
/// AWS Lambda was throttled by Amazon EC2 during Lambda function initialization using
/// the execution role provided for the Lambda function.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.EC2UnexpectedException">
/// AWS Lambda received an unexpected EC2 client exception while setting up for the Lambda
/// function.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.EFSIOException">
/// An error occured when reading from or writing to a connected file system.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.EFSMountConnectivityException">
/// The function couldn't make a network connection to the configured file system.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.EFSMountFailureException">
/// The function couldn't mount the configured file system due to a permission or configuration
/// issue.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.EFSMountTimeoutException">
/// The function was able to make a network connection to the configured file system,
/// but the mount operation timed out.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ENILimitReachedException">
/// AWS Lambda was not able to create an elastic network interface in the VPC, specified
/// as part of Lambda function configuration, because the limit for network interfaces
/// has been reached.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidRequestContentException">
/// The request body could not be parsed as JSON.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidRuntimeException">
/// The runtime or runtime version specified is not supported.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidSecurityGroupIDException">
/// The Security Group ID provided in the Lambda function VPC configuration is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidSubnetIDException">
/// The Subnet ID provided in the Lambda function VPC configuration is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidZipFileException">
/// AWS Lambda could not unzip the deployment package.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.KMSAccessDeniedException">
/// Lambda was unable to decrypt the environment variables because KMS access was denied.
/// Check the Lambda function's KMS permissions.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.KMSDisabledException">
/// Lambda was unable to decrypt the environment variables because the KMS key used is
/// disabled. Check the Lambda function's KMS key settings.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.KMSInvalidStateException">
/// Lambda was unable to decrypt the environment variables because the KMS key used is
/// in an invalid state for Decrypt. Check the function's KMS key settings.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.KMSNotFoundException">
/// Lambda was unable to decrypt the environment variables because the KMS key was not
/// found. Check the function's KMS key settings.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.RequestTooLargeException">
/// The request payload exceeded the <code>Invoke</code> request body JSON input limit.
/// For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">Limits</a>.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotReadyException">
/// The function is inactive and its VPC connection is no longer available. Wait for the
/// VPC connection to reestablish and try again.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.SubnetIPAddressLimitReachedException">
/// AWS Lambda was not able to set up VPC access for the Lambda function because one or
/// more configured subnets has no available IP addresses.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.UnsupportedMediaTypeException">
/// The content type of the <code>Invoke</code> request body is not JSON.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/Invoke">REST API Reference for Invoke Operation</seealso>
public virtual InvokeResponse Invoke(InvokeRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = InvokeRequestMarshaller.Instance;
options.ResponseUnmarshaller = InvokeResponseUnmarshaller.Instance;
return Invoke<InvokeResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the Invoke operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the Invoke operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndInvoke
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/Invoke">REST API Reference for Invoke Operation</seealso>
public virtual IAsyncResult BeginInvoke(InvokeRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = InvokeRequestMarshaller.Instance;
options.ResponseUnmarshaller = InvokeResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the Invoke operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginInvoke.</param>
///
/// <returns>Returns a InvokeResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/Invoke">REST API Reference for Invoke Operation</seealso>
public virtual InvokeResponse EndInvoke(IAsyncResult asyncResult)
{
return EndInvoke<InvokeResponse>(asyncResult);
}
#endregion
#region InvokeAsync
/// <summary>
/// <important>
/// <para>
/// For asynchronous function invocation, use <a>Invoke</a>.
/// </para>
/// </important>
/// <para>
/// Invokes a function asynchronously.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the InvokeAsync service method.</param>
///
/// <returns>The response from the InvokeAsync service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidRequestContentException">
/// The request body could not be parsed as JSON.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidRuntimeException">
/// The runtime or runtime version specified is not supported.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvokeAsync">REST API Reference for InvokeAsync Operation</seealso>
[Obsolete("For .NET 3.5/4.5, API InvokeAsyncResponse InvokeAsync(InvokeAsyncRequest) is deprecated, use InvokeResponse Invoke(InvokeRequest), or Task<InvokeResponse> InvokeAsync(InvokeRequest, CancellationToken) instead. For .NET Core, Task<InvokeAsyncResponse> InvokeAsyncAsync(InvokeAsyncRequest, CancellationToken) is deprecated, use Task<InvokeResponse> InvokeAsync(InvokeRequest, CancellationToken) instead.")]
public virtual InvokeAsyncResponse InvokeAsync(InvokeAsyncRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = InvokeAsyncRequestMarshaller.Instance;
options.ResponseUnmarshaller = InvokeAsyncResponseUnmarshaller.Instance;
return Invoke<InvokeAsyncResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the InvokeAsync operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the InvokeAsync operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndInvokeAsync
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvokeAsync">REST API Reference for InvokeAsync Operation</seealso>
[Obsolete("For .NET 3.5/4.5, API InvokeAsyncResponse InvokeAsync(InvokeAsyncRequest) is deprecated, use InvokeResponse Invoke(InvokeRequest), or Task<InvokeResponse> InvokeAsync(InvokeRequest, CancellationToken) instead. For .NET Core, Task<InvokeAsyncResponse> InvokeAsyncAsync(InvokeAsyncRequest, CancellationToken) is deprecated, use Task<InvokeResponse> InvokeAsync(InvokeRequest, CancellationToken) instead.")]
public virtual IAsyncResult BeginInvokeAsync(InvokeAsyncRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = InvokeAsyncRequestMarshaller.Instance;
options.ResponseUnmarshaller = InvokeAsyncResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the InvokeAsync operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginInvokeAsync.</param>
///
/// <returns>Returns a InvokeAsyncResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvokeAsync">REST API Reference for InvokeAsync Operation</seealso>
[Obsolete("For .NET 3.5/4.5, API InvokeAsyncResponse InvokeAsync(InvokeAsyncRequest) is deprecated, use InvokeResponse Invoke(InvokeRequest), or Task<InvokeResponse> InvokeAsync(InvokeRequest, CancellationToken) instead. For .NET Core, Task<InvokeAsyncResponse> InvokeAsyncAsync(InvokeAsyncRequest, CancellationToken) is deprecated, use Task<InvokeResponse> InvokeAsync(InvokeRequest, CancellationToken) instead.")]
public virtual InvokeAsyncResponse EndInvokeAsync(IAsyncResult asyncResult)
{
return EndInvoke<InvokeAsyncResponse>(asyncResult);
}
#endregion
#region ListAliases
/// <summary>
/// Returns a list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">aliases</a>
/// for a Lambda function.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListAliases service method.</param>
///
/// <returns>The response from the ListAliases service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListAliases">REST API Reference for ListAliases Operation</seealso>
public virtual ListAliasesResponse ListAliases(ListAliasesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListAliasesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListAliasesResponseUnmarshaller.Instance;
return Invoke<ListAliasesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListAliases operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListAliases operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListAliases
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListAliases">REST API Reference for ListAliases Operation</seealso>
public virtual IAsyncResult BeginListAliases(ListAliasesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListAliasesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListAliasesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListAliases operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListAliases.</param>
///
/// <returns>Returns a ListAliasesResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListAliases">REST API Reference for ListAliases Operation</seealso>
public virtual ListAliasesResponse EndListAliases(IAsyncResult asyncResult)
{
return EndInvoke<ListAliasesResponse>(asyncResult);
}
#endregion
#region ListEventSourceMappings
/// <summary>
/// Lists event source mappings. Specify an <code>EventSourceArn</code> to only show event
/// source mappings for a single event source.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListEventSourceMappings service method.</param>
///
/// <returns>The response from the ListEventSourceMappings service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListEventSourceMappings">REST API Reference for ListEventSourceMappings Operation</seealso>
public virtual ListEventSourceMappingsResponse ListEventSourceMappings(ListEventSourceMappingsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListEventSourceMappingsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListEventSourceMappingsResponseUnmarshaller.Instance;
return Invoke<ListEventSourceMappingsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListEventSourceMappings operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListEventSourceMappings operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListEventSourceMappings
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListEventSourceMappings">REST API Reference for ListEventSourceMappings Operation</seealso>
public virtual IAsyncResult BeginListEventSourceMappings(ListEventSourceMappingsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListEventSourceMappingsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListEventSourceMappingsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListEventSourceMappings operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListEventSourceMappings.</param>
///
/// <returns>Returns a ListEventSourceMappingsResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListEventSourceMappings">REST API Reference for ListEventSourceMappings Operation</seealso>
public virtual ListEventSourceMappingsResponse EndListEventSourceMappings(IAsyncResult asyncResult)
{
return EndInvoke<ListEventSourceMappingsResponse>(asyncResult);
}
#endregion
#region ListFunctionEventInvokeConfigs
/// <summary>
/// Retrieves a list of configurations for asynchronous invocation for a function.
///
///
/// <para>
/// To configure options for asynchronous invocation, use <a>PutFunctionEventInvokeConfig</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListFunctionEventInvokeConfigs service method.</param>
///
/// <returns>The response from the ListFunctionEventInvokeConfigs service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctionEventInvokeConfigs">REST API Reference for ListFunctionEventInvokeConfigs Operation</seealso>
public virtual ListFunctionEventInvokeConfigsResponse ListFunctionEventInvokeConfigs(ListFunctionEventInvokeConfigsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListFunctionEventInvokeConfigsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListFunctionEventInvokeConfigsResponseUnmarshaller.Instance;
return Invoke<ListFunctionEventInvokeConfigsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListFunctionEventInvokeConfigs operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListFunctionEventInvokeConfigs operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListFunctionEventInvokeConfigs
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctionEventInvokeConfigs">REST API Reference for ListFunctionEventInvokeConfigs Operation</seealso>
public virtual IAsyncResult BeginListFunctionEventInvokeConfigs(ListFunctionEventInvokeConfigsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListFunctionEventInvokeConfigsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListFunctionEventInvokeConfigsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListFunctionEventInvokeConfigs operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListFunctionEventInvokeConfigs.</param>
///
/// <returns>Returns a ListFunctionEventInvokeConfigsResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctionEventInvokeConfigs">REST API Reference for ListFunctionEventInvokeConfigs Operation</seealso>
public virtual ListFunctionEventInvokeConfigsResponse EndListFunctionEventInvokeConfigs(IAsyncResult asyncResult)
{
return EndInvoke<ListFunctionEventInvokeConfigsResponse>(asyncResult);
}
#endregion
#region ListFunctions
/// <summary>
/// Returns a list of Lambda functions, with the version-specific configuration of each.
/// Lambda returns up to 50 functions per call.
///
///
/// <para>
/// Set <code>FunctionVersion</code> to <code>ALL</code> to include all published versions
/// of each function in addition to the unpublished version. To get more information about
/// a function or version, use <a>GetFunction</a>.
/// </para>
/// </summary>
///
/// <returns>The response from the ListFunctions service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctions">REST API Reference for ListFunctions Operation</seealso>
public virtual ListFunctionsResponse ListFunctions()
{
var request = new ListFunctionsRequest();
return ListFunctions(request);
}
/// <summary>
/// Returns a list of Lambda functions, with the version-specific configuration of each.
/// Lambda returns up to 50 functions per call.
///
///
/// <para>
/// Set <code>FunctionVersion</code> to <code>ALL</code> to include all published versions
/// of each function in addition to the unpublished version. To get more information about
/// a function or version, use <a>GetFunction</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListFunctions service method.</param>
///
/// <returns>The response from the ListFunctions service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctions">REST API Reference for ListFunctions Operation</seealso>
public virtual ListFunctionsResponse ListFunctions(ListFunctionsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListFunctionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListFunctionsResponseUnmarshaller.Instance;
return Invoke<ListFunctionsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListFunctions operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListFunctions operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListFunctions
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctions">REST API Reference for ListFunctions Operation</seealso>
public virtual IAsyncResult BeginListFunctions(ListFunctionsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListFunctionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListFunctionsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListFunctions operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListFunctions.</param>
///
/// <returns>Returns a ListFunctionsResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctions">REST API Reference for ListFunctions Operation</seealso>
public virtual ListFunctionsResponse EndListFunctions(IAsyncResult asyncResult)
{
return EndInvoke<ListFunctionsResponse>(asyncResult);
}
#endregion
#region ListLayers
/// <summary>
/// Lists <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layers</a> and shows information about the latest version of each. Specify
/// a <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html">runtime
/// identifier</a> to list only layers that indicate that they're compatible with that
/// runtime.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListLayers service method.</param>
///
/// <returns>The response from the ListLayers service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListLayers">REST API Reference for ListLayers Operation</seealso>
public virtual ListLayersResponse ListLayers(ListLayersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListLayersRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListLayersResponseUnmarshaller.Instance;
return Invoke<ListLayersResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListLayers operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListLayers operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListLayers
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListLayers">REST API Reference for ListLayers Operation</seealso>
public virtual IAsyncResult BeginListLayers(ListLayersRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListLayersRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListLayersResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListLayers operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListLayers.</param>
///
/// <returns>Returns a ListLayersResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListLayers">REST API Reference for ListLayers Operation</seealso>
public virtual ListLayersResponse EndListLayers(IAsyncResult asyncResult)
{
return EndInvoke<ListLayersResponse>(asyncResult);
}
#endregion
#region ListLayerVersions
/// <summary>
/// Lists the versions of an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layer</a>. Versions that have been deleted aren't listed. Specify a <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html">runtime
/// identifier</a> to list only versions that indicate that they're compatible with that
/// runtime.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListLayerVersions service method.</param>
///
/// <returns>The response from the ListLayerVersions service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListLayerVersions">REST API Reference for ListLayerVersions Operation</seealso>
public virtual ListLayerVersionsResponse ListLayerVersions(ListLayerVersionsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListLayerVersionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListLayerVersionsResponseUnmarshaller.Instance;
return Invoke<ListLayerVersionsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListLayerVersions operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListLayerVersions operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListLayerVersions
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListLayerVersions">REST API Reference for ListLayerVersions Operation</seealso>
public virtual IAsyncResult BeginListLayerVersions(ListLayerVersionsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListLayerVersionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListLayerVersionsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListLayerVersions operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListLayerVersions.</param>
///
/// <returns>Returns a ListLayerVersionsResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListLayerVersions">REST API Reference for ListLayerVersions Operation</seealso>
public virtual ListLayerVersionsResponse EndListLayerVersions(IAsyncResult asyncResult)
{
return EndInvoke<ListLayerVersionsResponse>(asyncResult);
}
#endregion
#region ListProvisionedConcurrencyConfigs
/// <summary>
/// Retrieves a list of provisioned concurrency configurations for a function.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListProvisionedConcurrencyConfigs service method.</param>
///
/// <returns>The response from the ListProvisionedConcurrencyConfigs service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListProvisionedConcurrencyConfigs">REST API Reference for ListProvisionedConcurrencyConfigs Operation</seealso>
public virtual ListProvisionedConcurrencyConfigsResponse ListProvisionedConcurrencyConfigs(ListProvisionedConcurrencyConfigsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListProvisionedConcurrencyConfigsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListProvisionedConcurrencyConfigsResponseUnmarshaller.Instance;
return Invoke<ListProvisionedConcurrencyConfigsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListProvisionedConcurrencyConfigs operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListProvisionedConcurrencyConfigs operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListProvisionedConcurrencyConfigs
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListProvisionedConcurrencyConfigs">REST API Reference for ListProvisionedConcurrencyConfigs Operation</seealso>
public virtual IAsyncResult BeginListProvisionedConcurrencyConfigs(ListProvisionedConcurrencyConfigsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListProvisionedConcurrencyConfigsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListProvisionedConcurrencyConfigsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListProvisionedConcurrencyConfigs operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListProvisionedConcurrencyConfigs.</param>
///
/// <returns>Returns a ListProvisionedConcurrencyConfigsResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListProvisionedConcurrencyConfigs">REST API Reference for ListProvisionedConcurrencyConfigs Operation</seealso>
public virtual ListProvisionedConcurrencyConfigsResponse EndListProvisionedConcurrencyConfigs(IAsyncResult asyncResult)
{
return EndInvoke<ListProvisionedConcurrencyConfigsResponse>(asyncResult);
}
#endregion
#region ListTags
/// <summary>
/// Returns a function's <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a>.
/// You can also view tags with <a>GetFunction</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTags service method.</param>
///
/// <returns>The response from the ListTags service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListTags">REST API Reference for ListTags Operation</seealso>
public virtual ListTagsResponse ListTags(ListTagsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsResponseUnmarshaller.Instance;
return Invoke<ListTagsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTags operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTags operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTags
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListTags">REST API Reference for ListTags Operation</seealso>
public virtual IAsyncResult BeginListTags(ListTagsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListTags operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListTags.</param>
///
/// <returns>Returns a ListTagsResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListTags">REST API Reference for ListTags Operation</seealso>
public virtual ListTagsResponse EndListTags(IAsyncResult asyncResult)
{
return EndInvoke<ListTagsResponse>(asyncResult);
}
#endregion
#region ListVersionsByFunction
/// <summary>
/// Returns a list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">versions</a>,
/// with the version-specific configuration of each. Lambda returns up to 50 versions
/// per call.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListVersionsByFunction service method.</param>
///
/// <returns>The response from the ListVersionsByFunction service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListVersionsByFunction">REST API Reference for ListVersionsByFunction Operation</seealso>
public virtual ListVersionsByFunctionResponse ListVersionsByFunction(ListVersionsByFunctionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListVersionsByFunctionRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListVersionsByFunctionResponseUnmarshaller.Instance;
return Invoke<ListVersionsByFunctionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListVersionsByFunction operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListVersionsByFunction operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListVersionsByFunction
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListVersionsByFunction">REST API Reference for ListVersionsByFunction Operation</seealso>
public virtual IAsyncResult BeginListVersionsByFunction(ListVersionsByFunctionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListVersionsByFunctionRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListVersionsByFunctionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListVersionsByFunction operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListVersionsByFunction.</param>
///
/// <returns>Returns a ListVersionsByFunctionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListVersionsByFunction">REST API Reference for ListVersionsByFunction Operation</seealso>
public virtual ListVersionsByFunctionResponse EndListVersionsByFunction(IAsyncResult asyncResult)
{
return EndInvoke<ListVersionsByFunctionResponse>(asyncResult);
}
#endregion
#region PublishLayerVersion
/// <summary>
/// Creates an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layer</a> from a ZIP archive. Each time you call <code>PublishLayerVersion</code>
/// with the same layer name, a new version is created.
///
///
/// <para>
/// Add layers to your function with <a>CreateFunction</a> or <a>UpdateFunctionConfiguration</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PublishLayerVersion service method.</param>
///
/// <returns>The response from the PublishLayerVersion service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.CodeStorageExceededException">
/// You have exceeded your maximum total code size per account. <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">Learn
/// more</a>
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PublishLayerVersion">REST API Reference for PublishLayerVersion Operation</seealso>
public virtual PublishLayerVersionResponse PublishLayerVersion(PublishLayerVersionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PublishLayerVersionRequestMarshaller.Instance;
options.ResponseUnmarshaller = PublishLayerVersionResponseUnmarshaller.Instance;
return Invoke<PublishLayerVersionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PublishLayerVersion operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PublishLayerVersion operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPublishLayerVersion
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PublishLayerVersion">REST API Reference for PublishLayerVersion Operation</seealso>
public virtual IAsyncResult BeginPublishLayerVersion(PublishLayerVersionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PublishLayerVersionRequestMarshaller.Instance;
options.ResponseUnmarshaller = PublishLayerVersionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PublishLayerVersion operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPublishLayerVersion.</param>
///
/// <returns>Returns a PublishLayerVersionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PublishLayerVersion">REST API Reference for PublishLayerVersion Operation</seealso>
public virtual PublishLayerVersionResponse EndPublishLayerVersion(IAsyncResult asyncResult)
{
return EndInvoke<PublishLayerVersionResponse>(asyncResult);
}
#endregion
#region PublishVersion
/// <summary>
/// Creates a <a href="https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">version</a>
/// from the current code and configuration of a function. Use versions to create a snapshot
/// of your function code and configuration that doesn't change.
///
///
/// <para>
/// AWS Lambda doesn't publish a version if the function's configuration and code haven't
/// changed since the last version. Use <a>UpdateFunctionCode</a> or <a>UpdateFunctionConfiguration</a>
/// to update the function before publishing a version.
/// </para>
///
/// <para>
/// Clients can invoke versions directly or with an alias. To create an alias, use <a>CreateAlias</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PublishVersion service method.</param>
///
/// <returns>The response from the PublishVersion service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.CodeStorageExceededException">
/// You have exceeded your maximum total code size per account. <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">Learn
/// more</a>
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PreconditionFailedException">
/// The RevisionId provided does not match the latest RevisionId for the Lambda function
/// or alias. Call the <code>GetFunction</code> or the <code>GetAlias</code> API to retrieve
/// the latest RevisionId for your resource.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PublishVersion">REST API Reference for PublishVersion Operation</seealso>
public virtual PublishVersionResponse PublishVersion(PublishVersionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PublishVersionRequestMarshaller.Instance;
options.ResponseUnmarshaller = PublishVersionResponseUnmarshaller.Instance;
return Invoke<PublishVersionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PublishVersion operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PublishVersion operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPublishVersion
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PublishVersion">REST API Reference for PublishVersion Operation</seealso>
public virtual IAsyncResult BeginPublishVersion(PublishVersionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PublishVersionRequestMarshaller.Instance;
options.ResponseUnmarshaller = PublishVersionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PublishVersion operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPublishVersion.</param>
///
/// <returns>Returns a PublishVersionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PublishVersion">REST API Reference for PublishVersion Operation</seealso>
public virtual PublishVersionResponse EndPublishVersion(IAsyncResult asyncResult)
{
return EndInvoke<PublishVersionResponse>(asyncResult);
}
#endregion
#region PutFunctionConcurrency
/// <summary>
/// Sets the maximum number of simultaneous executions for a function, and reserves capacity
/// for that concurrency level.
///
///
/// <para>
/// Concurrency settings apply to the function as a whole, including all published versions
/// and the unpublished version. Reserving concurrency both ensures that your function
/// has capacity to process the specified number of events simultaneously, and prevents
/// it from scaling beyond that level. Use <a>GetFunction</a> to see the current setting
/// for a function.
/// </para>
///
/// <para>
/// Use <a>GetAccountSettings</a> to see your Regional concurrency limit. You can reserve
/// concurrency for as many functions as you like, as long as you leave at least 100 simultaneous
/// executions unreserved for functions that aren't configured with a per-function limit.
/// For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html">Managing
/// Concurrency</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutFunctionConcurrency service method.</param>
///
/// <returns>The response from the PutFunctionConcurrency service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutFunctionConcurrency">REST API Reference for PutFunctionConcurrency Operation</seealso>
public virtual PutFunctionConcurrencyResponse PutFunctionConcurrency(PutFunctionConcurrencyRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutFunctionConcurrencyRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutFunctionConcurrencyResponseUnmarshaller.Instance;
return Invoke<PutFunctionConcurrencyResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutFunctionConcurrency operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutFunctionConcurrency operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutFunctionConcurrency
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutFunctionConcurrency">REST API Reference for PutFunctionConcurrency Operation</seealso>
public virtual IAsyncResult BeginPutFunctionConcurrency(PutFunctionConcurrencyRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutFunctionConcurrencyRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutFunctionConcurrencyResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutFunctionConcurrency operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutFunctionConcurrency.</param>
///
/// <returns>Returns a PutFunctionConcurrencyResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutFunctionConcurrency">REST API Reference for PutFunctionConcurrency Operation</seealso>
public virtual PutFunctionConcurrencyResponse EndPutFunctionConcurrency(IAsyncResult asyncResult)
{
return EndInvoke<PutFunctionConcurrencyResponse>(asyncResult);
}
#endregion
#region PutFunctionEventInvokeConfig
/// <summary>
/// Configures options for <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html">asynchronous
/// invocation</a> on a function, version, or alias. If a configuration already exists
/// for a function, version, or alias, this operation overwrites it. If you exclude any
/// settings, they are removed. To set one option without affecting existing settings
/// for other options, use <a>UpdateFunctionEventInvokeConfig</a>.
///
///
/// <para>
/// By default, Lambda retries an asynchronous invocation twice if the function returns
/// an error. It retains events in a queue for up to six hours. When an event fails all
/// processing attempts or stays in the asynchronous invocation queue for too long, Lambda
/// discards it. To retain discarded events, configure a dead-letter queue with <a>UpdateFunctionConfiguration</a>.
/// </para>
///
/// <para>
/// To send an invocation record to a queue, topic, function, or event bus, specify a
/// <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">destination</a>.
/// You can configure separate destinations for successful invocations (on-success) and
/// events that fail all processing attempts (on-failure). You can configure destinations
/// in addition to or instead of a dead-letter queue.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutFunctionEventInvokeConfig service method.</param>
///
/// <returns>The response from the PutFunctionEventInvokeConfig service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutFunctionEventInvokeConfig">REST API Reference for PutFunctionEventInvokeConfig Operation</seealso>
public virtual PutFunctionEventInvokeConfigResponse PutFunctionEventInvokeConfig(PutFunctionEventInvokeConfigRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutFunctionEventInvokeConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutFunctionEventInvokeConfigResponseUnmarshaller.Instance;
return Invoke<PutFunctionEventInvokeConfigResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutFunctionEventInvokeConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutFunctionEventInvokeConfig operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutFunctionEventInvokeConfig
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutFunctionEventInvokeConfig">REST API Reference for PutFunctionEventInvokeConfig Operation</seealso>
public virtual IAsyncResult BeginPutFunctionEventInvokeConfig(PutFunctionEventInvokeConfigRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutFunctionEventInvokeConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutFunctionEventInvokeConfigResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutFunctionEventInvokeConfig operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutFunctionEventInvokeConfig.</param>
///
/// <returns>Returns a PutFunctionEventInvokeConfigResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutFunctionEventInvokeConfig">REST API Reference for PutFunctionEventInvokeConfig Operation</seealso>
public virtual PutFunctionEventInvokeConfigResponse EndPutFunctionEventInvokeConfig(IAsyncResult asyncResult)
{
return EndInvoke<PutFunctionEventInvokeConfigResponse>(asyncResult);
}
#endregion
#region PutProvisionedConcurrencyConfig
/// <summary>
/// Adds a provisioned concurrency configuration to a function's alias or version.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutProvisionedConcurrencyConfig service method.</param>
///
/// <returns>The response from the PutProvisionedConcurrencyConfig service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutProvisionedConcurrencyConfig">REST API Reference for PutProvisionedConcurrencyConfig Operation</seealso>
public virtual PutProvisionedConcurrencyConfigResponse PutProvisionedConcurrencyConfig(PutProvisionedConcurrencyConfigRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutProvisionedConcurrencyConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutProvisionedConcurrencyConfigResponseUnmarshaller.Instance;
return Invoke<PutProvisionedConcurrencyConfigResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutProvisionedConcurrencyConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutProvisionedConcurrencyConfig operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutProvisionedConcurrencyConfig
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutProvisionedConcurrencyConfig">REST API Reference for PutProvisionedConcurrencyConfig Operation</seealso>
public virtual IAsyncResult BeginPutProvisionedConcurrencyConfig(PutProvisionedConcurrencyConfigRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutProvisionedConcurrencyConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutProvisionedConcurrencyConfigResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutProvisionedConcurrencyConfig operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutProvisionedConcurrencyConfig.</param>
///
/// <returns>Returns a PutProvisionedConcurrencyConfigResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutProvisionedConcurrencyConfig">REST API Reference for PutProvisionedConcurrencyConfig Operation</seealso>
public virtual PutProvisionedConcurrencyConfigResponse EndPutProvisionedConcurrencyConfig(IAsyncResult asyncResult)
{
return EndInvoke<PutProvisionedConcurrencyConfigResponse>(asyncResult);
}
#endregion
#region RemoveLayerVersionPermission
/// <summary>
/// Removes a statement from the permissions policy for a version of an <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">AWS
/// Lambda layer</a>. For more information, see <a>AddLayerVersionPermission</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveLayerVersionPermission service method.</param>
///
/// <returns>The response from the RemoveLayerVersionPermission service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PreconditionFailedException">
/// The RevisionId provided does not match the latest RevisionId for the Lambda function
/// or alias. Call the <code>GetFunction</code> or the <code>GetAlias</code> API to retrieve
/// the latest RevisionId for your resource.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemoveLayerVersionPermission">REST API Reference for RemoveLayerVersionPermission Operation</seealso>
public virtual RemoveLayerVersionPermissionResponse RemoveLayerVersionPermission(RemoveLayerVersionPermissionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveLayerVersionPermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveLayerVersionPermissionResponseUnmarshaller.Instance;
return Invoke<RemoveLayerVersionPermissionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the RemoveLayerVersionPermission operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the RemoveLayerVersionPermission operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRemoveLayerVersionPermission
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemoveLayerVersionPermission">REST API Reference for RemoveLayerVersionPermission Operation</seealso>
public virtual IAsyncResult BeginRemoveLayerVersionPermission(RemoveLayerVersionPermissionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveLayerVersionPermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveLayerVersionPermissionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the RemoveLayerVersionPermission operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginRemoveLayerVersionPermission.</param>
///
/// <returns>Returns a RemoveLayerVersionPermissionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemoveLayerVersionPermission">REST API Reference for RemoveLayerVersionPermission Operation</seealso>
public virtual RemoveLayerVersionPermissionResponse EndRemoveLayerVersionPermission(IAsyncResult asyncResult)
{
return EndInvoke<RemoveLayerVersionPermissionResponse>(asyncResult);
}
#endregion
#region RemovePermission
/// <summary>
/// Revokes function-use permission from an AWS service or another account. You can get
/// the ID of the statement from the output of <a>GetPolicy</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemovePermission service method.</param>
///
/// <returns>The response from the RemovePermission service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PreconditionFailedException">
/// The RevisionId provided does not match the latest RevisionId for the Lambda function
/// or alias. Call the <code>GetFunction</code> or the <code>GetAlias</code> API to retrieve
/// the latest RevisionId for your resource.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemovePermission">REST API Reference for RemovePermission Operation</seealso>
public virtual RemovePermissionResponse RemovePermission(RemovePermissionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemovePermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemovePermissionResponseUnmarshaller.Instance;
return Invoke<RemovePermissionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the RemovePermission operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the RemovePermission operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRemovePermission
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemovePermission">REST API Reference for RemovePermission Operation</seealso>
public virtual IAsyncResult BeginRemovePermission(RemovePermissionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemovePermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemovePermissionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the RemovePermission operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginRemovePermission.</param>
///
/// <returns>Returns a RemovePermissionResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemovePermission">REST API Reference for RemovePermission Operation</seealso>
public virtual RemovePermissionResponse EndRemovePermission(IAsyncResult asyncResult)
{
return EndInvoke<RemovePermissionResponse>(asyncResult);
}
#endregion
#region TagResource
/// <summary>
/// Adds <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a>
/// to a function.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TagResource service method.</param>
///
/// <returns>The response from the TagResource service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse TagResource(TagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return Invoke<TagResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the TagResource operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndTagResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual IAsyncResult BeginTagResource(TagResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginTagResource.</param>
///
/// <returns>Returns a TagResourceResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse EndTagResource(IAsyncResult asyncResult)
{
return EndInvoke<TagResourceResponse>(asyncResult);
}
#endregion
#region UntagResource
/// <summary>
/// Removes <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a>
/// from a function.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</param>
///
/// <returns>The response from the UntagResource service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse UntagResource(UntagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return Invoke<UntagResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UntagResource operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUntagResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual IAsyncResult BeginUntagResource(UntagResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUntagResource.</param>
///
/// <returns>Returns a UntagResourceResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse EndUntagResource(IAsyncResult asyncResult)
{
return EndInvoke<UntagResourceResponse>(asyncResult);
}
#endregion
#region UpdateAlias
/// <summary>
/// Updates the configuration of a Lambda function <a href="https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">alias</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateAlias service method.</param>
///
/// <returns>The response from the UpdateAlias service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PreconditionFailedException">
/// The RevisionId provided does not match the latest RevisionId for the Lambda function
/// or alias. Call the <code>GetFunction</code> or the <code>GetAlias</code> API to retrieve
/// the latest RevisionId for your resource.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateAlias">REST API Reference for UpdateAlias Operation</seealso>
public virtual UpdateAliasResponse UpdateAlias(UpdateAliasRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateAliasRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateAliasResponseUnmarshaller.Instance;
return Invoke<UpdateAliasResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateAlias operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateAlias operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateAlias
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateAlias">REST API Reference for UpdateAlias Operation</seealso>
public virtual IAsyncResult BeginUpdateAlias(UpdateAliasRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateAliasRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateAliasResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateAlias operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateAlias.</param>
///
/// <returns>Returns a UpdateAliasResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateAlias">REST API Reference for UpdateAlias Operation</seealso>
public virtual UpdateAliasResponse EndUpdateAlias(IAsyncResult asyncResult)
{
return EndInvoke<UpdateAliasResponse>(asyncResult);
}
#endregion
#region UpdateEventSourceMapping
/// <summary>
/// Updates an event source mapping. You can change the function that AWS Lambda invokes,
/// or pause invocation and resume later from the same location.
///
///
/// <para>
/// The following error handling options are only available for stream sources (DynamoDB
/// and Kinesis):
/// </para>
/// <ul> <li>
/// <para>
/// <code>BisectBatchOnFunctionError</code> - If the function returns an error, split
/// the batch in two and retry.
/// </para>
/// </li> <li>
/// <para>
/// <code>DestinationConfig</code> - Send discarded records to an Amazon SQS queue or
/// Amazon SNS topic.
/// </para>
/// </li> <li>
/// <para>
/// <code>MaximumRecordAgeInSeconds</code> - Discard records older than the specified
/// age. Default -1 (infinite). Minimum 60. Maximum 604800.
/// </para>
/// </li> <li>
/// <para>
/// <code>MaximumRetryAttempts</code> - Discard records after the specified number of
/// retries. Default -1 (infinite). Minimum 0. Maximum 10000. When infinite, failed records
/// will be retried until the record expires.
/// </para>
/// </li> <li>
/// <para>
/// <code>ParallelizationFactor</code> - Process multiple batches from each shard concurrently.
/// </para>
/// </li> </ul>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateEventSourceMapping service method.</param>
///
/// <returns>The response from the UpdateEventSourceMapping service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceInUseException">
/// The operation conflicts with the resource's availability. For example, you attempted
/// to update an EventSource Mapping in CREATING, or tried to delete a EventSource mapping
/// currently in the UPDATING state.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateEventSourceMapping">REST API Reference for UpdateEventSourceMapping Operation</seealso>
public virtual UpdateEventSourceMappingResponse UpdateEventSourceMapping(UpdateEventSourceMappingRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateEventSourceMappingRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateEventSourceMappingResponseUnmarshaller.Instance;
return Invoke<UpdateEventSourceMappingResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateEventSourceMapping operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateEventSourceMapping operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateEventSourceMapping
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateEventSourceMapping">REST API Reference for UpdateEventSourceMapping Operation</seealso>
public virtual IAsyncResult BeginUpdateEventSourceMapping(UpdateEventSourceMappingRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateEventSourceMappingRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateEventSourceMappingResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateEventSourceMapping operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateEventSourceMapping.</param>
///
/// <returns>Returns a UpdateEventSourceMappingResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateEventSourceMapping">REST API Reference for UpdateEventSourceMapping Operation</seealso>
public virtual UpdateEventSourceMappingResponse EndUpdateEventSourceMapping(IAsyncResult asyncResult)
{
return EndInvoke<UpdateEventSourceMappingResponse>(asyncResult);
}
#endregion
#region UpdateFunctionCode
/// <summary>
/// Updates a Lambda function's code.
///
///
/// <para>
/// The function's code is locked when you publish a version. You can't modify the code
/// of a published version, only the unpublished version.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFunctionCode service method.</param>
///
/// <returns>The response from the UpdateFunctionCode service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.CodeStorageExceededException">
/// You have exceeded your maximum total code size per account. <a href="https://docs.aws.amazon.com/lambda/latest/dg/limits.html">Learn
/// more</a>
/// </exception>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PreconditionFailedException">
/// The RevisionId provided does not match the latest RevisionId for the Lambda function
/// or alias. Call the <code>GetFunction</code> or the <code>GetAlias</code> API to retrieve
/// the latest RevisionId for your resource.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionCode">REST API Reference for UpdateFunctionCode Operation</seealso>
public virtual UpdateFunctionCodeResponse UpdateFunctionCode(UpdateFunctionCodeRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFunctionCodeRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFunctionCodeResponseUnmarshaller.Instance;
return Invoke<UpdateFunctionCodeResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateFunctionCode operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateFunctionCode operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateFunctionCode
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionCode">REST API Reference for UpdateFunctionCode Operation</seealso>
public virtual IAsyncResult BeginUpdateFunctionCode(UpdateFunctionCodeRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFunctionCodeRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFunctionCodeResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateFunctionCode operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateFunctionCode.</param>
///
/// <returns>Returns a UpdateFunctionCodeResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionCode">REST API Reference for UpdateFunctionCode Operation</seealso>
public virtual UpdateFunctionCodeResponse EndUpdateFunctionCode(IAsyncResult asyncResult)
{
return EndInvoke<UpdateFunctionCodeResponse>(asyncResult);
}
#endregion
#region UpdateFunctionConfiguration
/// <summary>
/// Modify the version-specific settings of a Lambda function.
///
///
/// <para>
/// When you update a function, Lambda provisions an instance of the function and its
/// supporting resources. If your function connects to a VPC, this process can take a
/// minute. During this time, you can't modify the function, but you can still invoke
/// it. The <code>LastUpdateStatus</code>, <code>LastUpdateStatusReason</code>, and <code>LastUpdateStatusReasonCode</code>
/// fields in the response from <a>GetFunctionConfiguration</a> indicate when the update
/// is complete and the function is processing events with the new configuration. For
/// more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/functions-states.html">Function
/// States</a>.
/// </para>
///
/// <para>
/// These settings can vary between versions of a function and are locked when you publish
/// a version. You can't modify the configuration of a published version, only the unpublished
/// version.
/// </para>
///
/// <para>
/// To configure function concurrency, use <a>PutFunctionConcurrency</a>. To grant invoke
/// permissions to an account or AWS service, use <a>AddPermission</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFunctionConfiguration service method.</param>
///
/// <returns>The response from the UpdateFunctionConfiguration service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.PreconditionFailedException">
/// The RevisionId provided does not match the latest RevisionId for the Lambda function
/// or alias. Call the <code>GetFunction</code> or the <code>GetAlias</code> API to retrieve
/// the latest RevisionId for your resource.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceConflictException">
/// The resource already exists, or another operation is in progress.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionConfiguration">REST API Reference for UpdateFunctionConfiguration Operation</seealso>
public virtual UpdateFunctionConfigurationResponse UpdateFunctionConfiguration(UpdateFunctionConfigurationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFunctionConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFunctionConfigurationResponseUnmarshaller.Instance;
return Invoke<UpdateFunctionConfigurationResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateFunctionConfiguration operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateFunctionConfiguration operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateFunctionConfiguration
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionConfiguration">REST API Reference for UpdateFunctionConfiguration Operation</seealso>
public virtual IAsyncResult BeginUpdateFunctionConfiguration(UpdateFunctionConfigurationRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFunctionConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFunctionConfigurationResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateFunctionConfiguration operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateFunctionConfiguration.</param>
///
/// <returns>Returns a UpdateFunctionConfigurationResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionConfiguration">REST API Reference for UpdateFunctionConfiguration Operation</seealso>
public virtual UpdateFunctionConfigurationResponse EndUpdateFunctionConfiguration(IAsyncResult asyncResult)
{
return EndInvoke<UpdateFunctionConfigurationResponse>(asyncResult);
}
#endregion
#region UpdateFunctionEventInvokeConfig
/// <summary>
/// Updates the configuration for asynchronous invocation for a function, version, or
/// alias.
///
///
/// <para>
/// To configure options for asynchronous invocation, use <a>PutFunctionEventInvokeConfig</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFunctionEventInvokeConfig service method.</param>
///
/// <returns>The response from the UpdateFunctionEventInvokeConfig service method, as returned by Lambda.</returns>
/// <exception cref="Amazon.Lambda.Model.InvalidParameterValueException">
/// One of the parameters in the request is invalid.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ResourceNotFoundException">
/// The resource specified in the request does not exist.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.ServiceException">
/// The AWS Lambda service encountered an internal error.
/// </exception>
/// <exception cref="Amazon.Lambda.Model.TooManyRequestsException">
/// The request throughput limit was exceeded.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionEventInvokeConfig">REST API Reference for UpdateFunctionEventInvokeConfig Operation</seealso>
public virtual UpdateFunctionEventInvokeConfigResponse UpdateFunctionEventInvokeConfig(UpdateFunctionEventInvokeConfigRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFunctionEventInvokeConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFunctionEventInvokeConfigResponseUnmarshaller.Instance;
return Invoke<UpdateFunctionEventInvokeConfigResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateFunctionEventInvokeConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateFunctionEventInvokeConfig operation on AmazonLambdaClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateFunctionEventInvokeConfig
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionEventInvokeConfig">REST API Reference for UpdateFunctionEventInvokeConfig Operation</seealso>
public virtual IAsyncResult BeginUpdateFunctionEventInvokeConfig(UpdateFunctionEventInvokeConfigRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFunctionEventInvokeConfigRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFunctionEventInvokeConfigResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateFunctionEventInvokeConfig operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateFunctionEventInvokeConfig.</param>
///
/// <returns>Returns a UpdateFunctionEventInvokeConfigResult from Lambda.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionEventInvokeConfig">REST API Reference for UpdateFunctionEventInvokeConfig Operation</seealso>
public virtual UpdateFunctionEventInvokeConfigResponse EndUpdateFunctionEventInvokeConfig(IAsyncResult asyncResult)
{
return EndInvoke<UpdateFunctionEventInvokeConfigResponse>(asyncResult);
}
#endregion
}
} | 58.238898 | 648 | 0.673472 | [
"Apache-2.0"
] | Singh400/aws-sdk-net | sdk/src/Services/Lambda/Generated/_bcl35/AmazonLambdaClient.cs | 245,244 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the events-2015-10-07.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.CloudWatchEvents.Model
{
/// <summary>
/// Container for the parameters to the ListTagsForResource operation.
/// Displays the tags associated with an EventBridge resource. In EventBridge, rules and
/// event buses can be tagged.
/// </summary>
public partial class ListTagsForResourceRequest : AmazonCloudWatchEventsRequest
{
private string _resourceARN;
/// <summary>
/// Gets and sets the property ResourceARN.
/// <para>
/// The ARN of the EventBridge resource for which you want to view tags.
/// </para>
/// </summary>
[AWSProperty(Required=true, Min=1, Max=1600)]
public string ResourceARN
{
get { return this._resourceARN; }
set { this._resourceARN = value; }
}
// Check to see if ResourceARN property is set
internal bool IsSetResourceARN()
{
return this._resourceARN != null;
}
}
} | 31.728814 | 104 | 0.669338 | [
"Apache-2.0"
] | NGL321/aws-sdk-net | sdk/src/Services/CloudWatchEvents/Generated/Model/ListTagsForResourceRequest.cs | 1,872 | C# |
#version 430
layout(local_size_x = 32, local_size_y = 32) in;
layout (std430, binding = 0) buffer position {
vec4 p[];
};
layout (std430, binding = 1) buffer velocity {
vec4 v[];
};
layout (std430, binding = 2) readonly buffer mass {
float m[];
};
uniform int size;
const float dt = 0.00005f;
const float G = 10.0f;
vec3 force(vec3 pB, vec3 pA){
const vec3 dir = pB - pA;
const float dist = length(dir);
if(dist == 0.0f) return vec3(0);
return normalize(dir)/(dist*dist);
}
void main() {
const uvec3 wsize = gl_WorkGroupSize*gl_NumWorkGroups;
const uint index = gl_GlobalInvocationID.x*wsize.y+gl_GlobalInvocationID.y;
if(index > size) return;
vec4 F = vec4(0.0f);
for(int i = 0; i < size; i++){
if(i == index)
continue;
F.xyz += G*force(p[i].xyz, p[index].xyz)*m[i];
}
//Black-Hole
F.xyz += G*force(vec3(0), p[index].xyz)*100.0f;
v[index] += dt*F;
p[index] += dt*v[index];
};
| 17.462963 | 77 | 0.622481 | [
"MIT"
] | EKALEB/TinyEngine | examples/16_Gravity/shader/gravity.cs | 943 | C# |
//Copyright (c) Service Stack LLC. All Rights Reserved.
//License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Web;
using Funq;
using ServiceStack.Logging;
using ServiceStack.Web;
namespace ServiceStack.Host.AspNet
{
public class AspNetRequest
: IHttpRequest
{
public static ILog log = LogManager.GetLogger(typeof(AspNetRequest));
public Container Container { get; set; }
private readonly HttpRequestBase request;
private readonly IHttpResponse response;
public AspNetRequest(HttpContextBase httpContext, string operationName = null)
: this(httpContext, operationName, RequestAttributes.None)
{
this.RequestAttributes = this.GetAttributes();
}
public AspNetRequest(HttpContextBase httpContext, string operationName, RequestAttributes requestAttributes)
{
this.OperationName = operationName;
this.RequestAttributes = requestAttributes;
this.request = httpContext.Request;
this.response = new AspNetResponse(httpContext.Response);
this.RequestPreferences = new RequestPreferences(httpContext);
}
public HttpRequestBase HttpRequest
{
get { return request; }
}
public object OriginalRequest
{
get { return request; }
}
public IResponse Response
{
get { return response; }
}
public IHttpResponse HttpResponse
{
get { return response; }
}
public RequestAttributes RequestAttributes { get; set; }
public IRequestPreferences RequestPreferences { get; private set; }
public T TryResolve<T>()
{
if (typeof(T) == typeof(IHttpRequest))
throw new Exception("You don't need to use IHttpRequest.TryResolve<IHttpRequest> to resolve itself");
if (typeof(T) == typeof(IHttpResponse))
throw new Exception("Resolve IHttpResponse with 'Response' property instead of IHttpRequest.TryResolve<IHttpResponse>");
return Container != null
? Container.TryResolve<T>()
: HostContext.TryResolve<T>();
}
public string OperationName { get; set; }
public object Dto { get; set; }
public string ContentType
{
get { return request.ContentType; }
}
private string httpMethod;
public string HttpMethod
{
get
{
return httpMethod
?? (httpMethod = Param(HttpHeaders.XHttpMethodOverride)
?? request.HttpMethod);
}
}
public string Verb
{
get { return HttpMethod; }
}
public string Param(string name)
{
return Headers[name]
?? QueryString[name]
?? FormData[name];
}
public bool IsLocal
{
get { return request.IsLocal; }
}
public string UserAgent
{
get { return request.UserAgent; }
}
private Dictionary<string, object> items;
public Dictionary<string, object> Items
{
get
{
if (items == null)
{
items = new Dictionary<string, object>();
}
return items;
}
}
private string responseContentType;
public string ResponseContentType
{
get
{
if (responseContentType == null)
{
responseContentType = this.GetResponseContentType();
}
return responseContentType;
}
set
{
this.responseContentType = value;
HasExplicitResponseContentType = true;
}
}
public bool HasExplicitResponseContentType { get; private set; }
private Dictionary<string, Cookie> cookies;
public IDictionary<string, Cookie> Cookies
{
get
{
if (cookies == null)
{
cookies = new Dictionary<string, Cookie>();
for (var i = 0; i < this.request.Cookies.Count; i++)
{
var httpCookie = this.request.Cookies[i];
if (httpCookie == null)
continue;
Cookie cookie = null;
// try-catch needed as malformed cookie names (e.g. '$Version') can be returned
// from Cookie.Name, but the Cookie constructor will throw for these names.
try
{
cookie = new Cookie(httpCookie.Name, httpCookie.Value, httpCookie.Path, httpCookie.Domain)
{
HttpOnly = httpCookie.HttpOnly,
Secure = httpCookie.Secure,
Expires = httpCookie.Expires,
};
}
catch(Exception ex)
{
log.Warn("Error trying to create System.Net.Cookie: " + httpCookie.Name, ex);
}
if (cookie != null)
cookies[httpCookie.Name] = cookie;
}
}
return cookies;
}
}
private NameValueCollectionWrapper headers;
public INameValueCollection Headers
{
get { return headers ?? (headers = new NameValueCollectionWrapper(request.Headers)); }
}
private NameValueCollectionWrapper queryString;
public INameValueCollection QueryString
{
get { return queryString ?? (queryString = new NameValueCollectionWrapper(request.QueryString)); }
}
private NameValueCollectionWrapper formData;
public INameValueCollection FormData
{
get { return formData ?? (formData = new NameValueCollectionWrapper(request.Form)); }
}
public string GetRawBody()
{
if (bufferedStream != null)
{
return bufferedStream.ToArray().FromUtf8Bytes();
}
using (var reader = new StreamReader(InputStream))
{
return reader.ReadToEnd();
}
}
public string RawUrl
{
get { return request.RawUrl; }
}
public string AbsoluteUri
{
get
{
try
{
return HostContext.Config.StripApplicationVirtualPath
? request.Url.GetLeftPart(UriPartial.Authority)
.CombineWith(HostContext.Config.HandlerFactoryPath)
.CombineWith(PathInfo)
.TrimEnd('/')
: request.Url.AbsoluteUri.TrimEnd('/');
}
catch (Exception)
{
//fastcgi mono, do a 2nd rounds best efforts
return "http://" + request.UserHostName + request.RawUrl;
}
}
}
public string UserHostAddress
{
get { return request.UserHostAddress; }
}
public string XForwardedFor
{
get
{
return string.IsNullOrEmpty(request.Headers[HttpHeaders.XForwardedFor]) ? null : request.Headers[HttpHeaders.XForwardedFor];
}
}
public int? XForwardedPort
{
get
{
return string.IsNullOrEmpty(request.Headers[HttpHeaders.XForwardedPort]) ? (int?) null : int.Parse(request.Headers[HttpHeaders.XForwardedPort]);
}
}
public string XForwardedProtocol
{
get
{
return string.IsNullOrEmpty(request.Headers[HttpHeaders.XForwardedProtocol]) ? null : request.Headers[HttpHeaders.XForwardedProtocol];
}
}
public string XRealIp
{
get
{
return string.IsNullOrEmpty(request.Headers[HttpHeaders.XRealIp]) ? null : request.Headers[HttpHeaders.XRealIp];
}
}
private string remoteIp;
public string RemoteIp
{
get
{
return remoteIp ?? (remoteIp = XForwardedFor ?? (XRealIp ?? request.UserHostAddress));
}
}
public bool IsSecureConnection
{
get { return request.IsSecureConnection || XForwardedProtocol == "https"; }
}
public string[] AcceptTypes
{
get { return request.AcceptTypes; }
}
public string PathInfo
{
get { return request.GetPathInfo(); }
}
public string UrlHostName
{
get { return request.GetUrlHostName(); }
}
public bool UseBufferedStream
{
get { return bufferedStream != null; }
set
{
bufferedStream = value
? bufferedStream ?? new MemoryStream(request.InputStream.ReadFully())
: null;
}
}
private MemoryStream bufferedStream;
public Stream InputStream
{
get { return bufferedStream ?? request.InputStream; }
}
public long ContentLength
{
get { return request.ContentLength; }
}
private IHttpFile[] httpFiles;
public IHttpFile[] Files
{
get
{
if (httpFiles == null)
{
httpFiles = new IHttpFile[request.Files.Count];
for (var i = 0; i < request.Files.Count; i++)
{
var reqFile = request.Files[i];
httpFiles[i] = new HttpFile
{
ContentType = reqFile.ContentType,
ContentLength = reqFile.ContentLength,
FileName = reqFile.FileName,
InputStream = reqFile.InputStream,
};
}
}
return httpFiles;
}
}
public Uri UrlReferrer
{
get { return request.UrlReferrer; }
}
}
} | 30.869919 | 161 | 0.482047 | [
"Apache-2.0"
] | FernandoPinheiro/ServiceStack | src/ServiceStack/Host/AspNet/AspNetRequest.cs | 11,023 | C# |
using System;
namespace eShoppingSimple.Shippings.Domain.Contracts
{
/// <summary>
/// Data interface of an order
/// </summary>
public interface IOrder
{
/// <summary>
/// Id of the order
/// </summary>
Guid Id { get; }
}
}
| 16.705882 | 52 | 0.53169 | [
"MIT"
] | apirker/eShoppingSimple | eShoppingSimple.Shippings.Domain/Contracts/IOrder.cs | 286 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoftbankBillingSpecDownloader.IO
{
/// <summary>
/// 区切り文字形式での書き込み機能を提供します。
/// </summary>
public class SeparatedValuesWriter : IDisposable
{
#region フィールド / プロパティ
/// <summary>
/// 書き込み機能を保持します。
/// </summary>
private readonly TextWriter writer = null;
/// <summary>
/// 区切り文字形式での書き込み設定を取得します。
/// </summary>
public SeparatedValuesWriterSetting Setting{ get; private set; }
#endregion
#region コンストラクタ
/// <summary>
/// インスタンスを生成します。
/// </summary>
/// <param name="path">ファイルの書き込み先の絶対パス</param>
/// <param name="setting">書き込み設定</param>
public SeparatedValuesWriter(string path, SeparatedValuesWriterSetting setting)
: this(path, Encoding.UTF8, setting)
{}
/// <summary>
/// インスタンスを生成します。
/// </summary>
/// <param name="path">ファイルの書き込み先の絶対パス</param>
/// <param name="encoding">エンコーディング</param>
/// <param name="setting">書き込み設定</param>
public SeparatedValuesWriter(string path, Encoding encoding, SeparatedValuesWriterSetting setting)
: this(new StreamWriter(path, false, encoding), setting)
{}
/// <summary>
/// インスタンスを生成します。
/// </summary>
/// <param name="path">ファイルの書き込み先の絶対パス</param>
/// <param name="append">既存ファイルの末尾に追加書き込みするか</param>
/// <param name="setting">書き込み設定</param>
public SeparatedValuesWriter(string path, bool append, SeparatedValuesWriterSetting setting)
: this(path, append, Encoding.UTF8, setting)
{}
/// <summary>
/// インスタンスを生成します。
/// </summary>
/// <param name="path">ファイルの書き込み先の絶対パス</param>
/// <param name="append">既存ファイルの末尾に追加書き込みするか</param>
/// <param name="encoding">エンコーディング</param>
/// <param name="setting">書き込み設定</param>
public SeparatedValuesWriter(string path, bool append, Encoding encoding, SeparatedValuesWriterSetting setting)
: this(new StreamWriter(path, append, encoding), setting)
{}
/// <summary>
/// インスタンスを生成します。
/// </summary>
/// <param name="stream">書き込み先のストリーム</param>
/// <param name="setting">書き込み設定</param>
public SeparatedValuesWriter(Stream stream, SeparatedValuesWriterSetting setting)
: this(stream, Encoding.UTF8, setting)
{}
/// <summary>
/// インスタンスを生成します。
/// </summary>
/// <param name="stream">書き込み先のストリーム</param>
/// <param name="encoding">エンコーディング</param>
/// <param name="setting">書き込み設定</param>
public SeparatedValuesWriter(Stream stream, Encoding encoding, SeparatedValuesWriterSetting setting)
: this(new StreamWriter(stream, encoding), setting)
{}
/// <summary>
/// インスタンスを生成します。
/// </summary>
/// <param name="writer">書き込み機能</param>
/// <param name="setting">書き込み設定</param>
public SeparatedValuesWriter(TextWriter writer, SeparatedValuesWriterSetting setting)
{
this.writer = writer;
this.Setting = setting;
}
#endregion
#region IDisposable メンバー
/// <summary>
/// 使用したリソースを破棄します。
/// </summary>
public void Dispose()
{
this.Close();
}
#endregion
#region 書き込み関連メソッド
/// <summary>
/// 行終端記号を書き込みます。
/// </summary>
public void WriteLine()
{
this.writer.WriteLine();
}
/// <summary>
/// 1行分のデータを書き込みます。
/// </summary>
/// <typeparam name="T">データ型</typeparam>
/// <param name="fields">書き込むデータのコレクション</param>
/// <param name="quoteAlways">データを常に引用符で括るかどうか</param>
public void WriteLine<T>(IEnumerable<T> fields, bool quoteAlways = false)
{
this.WriteLineAsync(fields, quoteAlways).Wait();
}
/// <summary>
/// 行終端記号を書き込みます。
/// </summary>
public Task WriteLineAsync()
{
return this.writer.WriteLineAsync();
}
/// <summary>
/// 1行分のデータを非同期に書き込みます。
/// </summary>
/// <typeparam name="T">データ型</typeparam>
/// <param name="fields">書き込むデータのコレクション</param>
/// <param name="quoteAlways">データを常に引用符で括るかどうか</param>
public Task WriteLineAsync<T>(IEnumerable<T> fields, bool quoteAlways = false)
{
if (fields == null)
throw new ArgumentNullException("fields");
var formated = fields.Select(x => this.FormatField(x, quoteAlways));
var record = string.Join(this.Setting.FieldSeparator, formated);
return this.writer.WriteAsync(record + this.Setting.RecordSeparator);
}
/// <summary>
/// 現在のライターのすべてのバッファーをクリアし、バッファー内のデータをデバイスに書き込みます。
/// </summary>
public void Flush()
{
this.writer.Flush();
}
/// <summary>
/// 現在のライターのすべてのバッファーを非同期にクリアし、バッファー内のデータをデバイスに書き込みます。
/// </summary>
public Task FlushAsync()
{
return this.writer.FlushAsync();
}
/// <summary>
/// 現在のライターを終了し、ライターに関連付けられたすべてのシステムリソースを開放します。
/// </summary>
public void Close()
{
this.writer.Close();
}
#endregion
#region 補助メソッド
/// <summary>
/// フィールド文字列を整形します。
/// </summary>
/// <typeparam name="T">フィールドデータの型</typeparam>
/// <param name="field">フィールドデータ</param>
/// <param name="quoteAlways">常に引用符で括るかどうか</param>
/// <returns>整形された文字列</returns>
private string FormatField<T>(T field, bool quoteAlways = false)
{
var text = field is string ? field as string
: field == null ? null
: field.ToString();
text = text ?? string.Empty;
if (quoteAlways || this.NeedsQuote(text))
{
var modifier = this.Setting.TextModifier;
var escape = modifier + modifier;
var builder = new StringBuilder(text);
builder.Replace(modifier, escape);
builder.Insert(0, modifier);
builder.Append(modifier);
return builder.ToString();
}
return text;
}
//--- 指定された文字列を引用符で括る必要があるかどうかを判定
private bool NeedsQuote(string text)
{
return text.Contains('\r')
|| text.Contains('\n')
|| text.Contains(this.Setting.TextModifier)
|| text.Contains(this.Setting.FieldSeparator)
|| text.StartsWith("\t")
|| text.StartsWith(" ")
|| text.EndsWith("\t")
|| text.EndsWith(" ");
}
#endregion
}
} | 30.196653 | 119 | 0.542469 | [
"MIT"
] | xin9le/SoftbankBillingSpecDownloader | SoftbankBillingSpecDownloader/IO/SeparatedValuesWriter.cs | 8,693 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using CGALDotNetGeometry.Numerics;
namespace CGALDotNet.Polygons
{
public static class PolygonWithHoles2Extension
{
public static GameObject ToUnityMesh(this PolygonWithHoles2 poly, string name, Vector3 position, Material material)
{
var indices = new List<int>();
poly.Triangulate(indices);
var points = new List<Point2d>();
poly.GetAllPoints(points);
Mesh mesh = ExtensionHelper.CreateMesh(points.ToArray(), ToArrayAndFlip(indices));
return ExtensionHelper.CreateGameobject(name, mesh, position, material);
}
private static int[] ToArrayAndFlip(List<int> indices)
{
var array = new int[indices.Count];
for (int i = 0; i < array.Length / 3; i++)
{
array[i * 3 + 2] = indices[i * 3 + 0];
array[i * 3 + 1] = indices[i * 3 + 1];
array[i * 3 + 0] = indices[i * 3 + 2];
}
return array;
}
}
}
| 26.619048 | 123 | 0.571556 | [
"MIT"
] | Scrawk/CGALDotNetUnity | Assets/CGALDotNet/Extensions/PolygonWithHoles2Extension.cs | 1,118 | C# |
namespace SignalR.Proximity
{
internal interface IConnectionBuilder<TContract> : IServicesBuilder
{
IConnection<TContract> Build();
}
}
| 19.625 | 71 | 0.700637 | [
"MIT"
] | chrisfactory/SignalR.Proximity | src/SignalR.Proximity/Builder/Container/ProximityEndPoint/ProximityConnection/IConnectionBuilder.cs | 159 | C# |
using RabbitMQ.Next.Publisher.Abstractions;
namespace RabbitMQ.Next.Publisher.Initializers
{
public class PriorityInitializer : IMessageInitializer
{
private readonly byte priority;
public PriorityInitializer(byte priority)
{
this.priority = priority;
}
public void Apply<TPayload>(TPayload payload, IMessageBuilder message)
=> message.Priority(this.priority);
}
} | 26.058824 | 78 | 0.677201 | [
"MIT"
] | sanych-sun/RabbitMQ.Next | src/RabbitMQ.Next.Publisher/Initializers/PriorityInitializer.cs | 443 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.EntityFrameworkCore.Utilities;
namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public class EntityType : TypeBase, IMutableEntityType, IConventionEntityType, IRuntimeEntityType
{
private const string DynamicProxyGenAssemblyName = "DynamicProxyGenAssembly2";
private readonly SortedSet<ForeignKey> _foreignKeys
= new(ForeignKeyComparer.Instance);
private readonly SortedDictionary<string, Navigation> _navigations
= new(StringComparer.Ordinal);
private readonly SortedDictionary<string, SkipNavigation> _skipNavigations
= new(StringComparer.Ordinal);
private readonly SortedDictionary<IReadOnlyList<IReadOnlyProperty>, Index> _unnamedIndexes
= new(PropertyListComparer.Instance);
private readonly SortedDictionary<string, Index> _namedIndexes
= new(StringComparer.Ordinal);
private readonly SortedDictionary<string, Property> _properties;
private readonly SortedDictionary<IReadOnlyList<IReadOnlyProperty>, Key> _keys
= new(PropertyListComparer.Instance);
private readonly SortedDictionary<string, ServiceProperty> _serviceProperties
= new(StringComparer.Ordinal);
private List<object>? _data;
private Key? _primaryKey;
private bool? _isKeyless;
private EntityType? _baseType;
private ChangeTrackingStrategy? _changeTrackingStrategy;
private InternalEntityTypeBuilder? _builder;
private ConfigurationSource? _primaryKeyConfigurationSource;
private ConfigurationSource? _isKeylessConfigurationSource;
private ConfigurationSource? _baseTypeConfigurationSource;
private ConfigurationSource? _changeTrackingStrategyConfigurationSource;
private ConfigurationSource? _constructorBindingConfigurationSource;
private ConfigurationSource? _serviceOnlyConstructorBindingConfigurationSource;
// Warning: Never access these fields directly as access needs to be thread-safe
private PropertyCounts? _counts;
// _serviceOnlyConstructorBinding needs to be set as well whenever _constructorBinding is set
private InstantiationBinding? _constructorBinding;
private InstantiationBinding? _serviceOnlyConstructorBinding;
private Func<InternalEntityEntry, ISnapshot>? _relationshipSnapshotFactory;
private Func<InternalEntityEntry, ISnapshot>? _originalValuesFactory;
private Func<InternalEntityEntry, ISnapshot>? _temporaryValuesFactory;
private Func<InternalEntityEntry, ISnapshot>? _storeGeneratedValuesFactory;
private Func<ValueBuffer, ISnapshot>? _shadowValuesFactory;
private Func<ISnapshot>? _emptyShadowValuesFactory;
private Func<MaterializationContext, object>? _instanceFactory;
private IProperty[]? _foreignKeyProperties;
private IProperty[]? _valueGeneratingProperties;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public EntityType(string name, Model model, ConfigurationSource configurationSource)
: base(name, Model.DefaultPropertyBagType, model, configurationSource)
{
_properties = new SortedDictionary<string, Property>(new PropertyNameComparer(this));
_builder = new InternalEntityTypeBuilder(this, model.Builder);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public EntityType(Type type, Model model, ConfigurationSource configurationSource)
: base(type, model, configurationSource)
{
if (!type.IsValidEntityType())
{
throw new ArgumentException(CoreStrings.InvalidEntityType(type));
}
if (DynamicProxyGenAssemblyName.Equals(
type.Assembly.GetName().Name, StringComparison.Ordinal))
{
throw new ArgumentException(
CoreStrings.AddingProxyTypeAsEntityType(type.FullName));
}
_properties = new SortedDictionary<string, Property>(new PropertyNameComparer(this));
_builder = new InternalEntityTypeBuilder(this, model.Builder);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public EntityType(string name, Type type, Model model, ConfigurationSource configurationSource)
: base(name, type, model, configurationSource)
{
if (!type.IsValidEntityType())
{
throw new ArgumentException(CoreStrings.InvalidEntityType(type));
}
if (DynamicProxyGenAssemblyName.Equals(
type.Assembly.GetName().Name, StringComparison.Ordinal))
{
throw new ArgumentException(
CoreStrings.AddingProxyTypeAsEntityType(type.FullName));
}
_properties = new SortedDictionary<string, Property>(new PropertyNameComparer(this));
_builder = new InternalEntityTypeBuilder(this, model.Builder);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual InternalEntityTypeBuilder Builder
{
[DebuggerStepThrough] get => _builder ?? throw new InvalidOperationException(CoreStrings.ObjectRemovedFromModel);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual bool IsInModel
=> _builder is not null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual void SetRemovedFromModel()
=> _builder = null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual EntityType? BaseType
=> _baseType;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual bool IsKeyless
{
get => RootType()._isKeyless ?? false;
set => SetIsKeyless(value, ConfigurationSource.Explicit);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
private string DisplayName() => ((IReadOnlyEntityType)this).DisplayName();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual bool? SetIsKeyless(bool? keyless, ConfigurationSource configurationSource)
{
EnsureMutable();
if (_isKeyless == keyless)
{
UpdateIsKeylessConfigurationSource(configurationSource);
return keyless;
}
if (keyless == true)
{
if (_baseType != null)
{
throw new InvalidOperationException(
CoreStrings.DerivedEntityTypeHasNoKey(DisplayName(), RootType().DisplayName()));
}
if (_keys.Count != 0)
{
throw new InvalidOperationException(CoreStrings.KeylessTypeExistingKey(
DisplayName(), _keys.First().Value.Properties.Format()));
}
}
_isKeyless = keyless;
if (keyless == null)
{
_isKeylessConfigurationSource = null;
}
else
{
UpdateIsKeylessConfigurationSource(configurationSource);
}
return keyless;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ConfigurationSource? GetIsKeylessConfigurationSource()
=> _isKeylessConfigurationSource;
private void UpdateIsKeylessConfigurationSource(ConfigurationSource configurationSource)
=> _isKeylessConfigurationSource = configurationSource.Max(_isKeylessConfigurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual EntityType? SetBaseType(EntityType? newBaseType, ConfigurationSource configurationSource)
{
EnsureMutable();
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
if (_baseType == newBaseType)
{
UpdateBaseTypeConfigurationSource(configurationSource);
newBaseType?.UpdateConfigurationSource(configurationSource);
return newBaseType;
}
var originalBaseType = _baseType;
_baseType?._directlyDerivedTypes.Remove(this);
_baseType = null;
if (newBaseType != null)
{
if (!newBaseType.ClrType.IsAssignableFrom(ClrType))
{
throw new InvalidOperationException(
CoreStrings.NotAssignableClrBaseType(
DisplayName(), newBaseType.DisplayName(), ClrType.ShortDisplayName(),
newBaseType.ClrType.ShortDisplayName()));
}
if (newBaseType.InheritsFrom(this))
{
throw new InvalidOperationException(CoreStrings.CircularInheritance(DisplayName(), newBaseType.DisplayName()));
}
if (_keys.Count > 0)
{
throw new InvalidOperationException(CoreStrings.DerivedEntityCannotHaveKeys(DisplayName()));
}
if (IsKeyless)
{
throw new InvalidOperationException(CoreStrings.DerivedEntityCannotBeKeyless(DisplayName()));
}
var conflictingMember = newBaseType.GetMembers()
.Select(p => p.Name)
.SelectMany(FindMembersInHierarchy)
.FirstOrDefault();
if (conflictingMember != null)
{
var baseProperty = newBaseType.FindMembersInHierarchy(conflictingMember.Name).Single();
throw new InvalidOperationException(
CoreStrings.DuplicatePropertiesOnBase(
DisplayName(),
newBaseType.DisplayName(),
((IReadOnlyTypeBase)conflictingMember.DeclaringType).DisplayName(),
conflictingMember.Name,
((IReadOnlyTypeBase)baseProperty.DeclaringType).DisplayName(),
baseProperty.Name));
}
_baseType = newBaseType;
_baseType._directlyDerivedTypes.Add(this);
}
UpdateBaseTypeConfigurationSource(configurationSource);
newBaseType?.UpdateConfigurationSource(configurationSource);
return (EntityType?)Model.ConventionDispatcher.OnEntityTypeBaseTypeChanged(Builder, newBaseType, originalBaseType);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual void OnTypeRemoved()
{
if (_foreignKeys.Count > 0)
{
foreach (var foreignKey in GetDeclaredForeignKeys().ToList())
{
if (foreignKey.PrincipalEntityType != this)
{
RemoveForeignKey(foreignKey);
}
}
}
if (_skipNavigations.Count > 0)
{
foreach (var skipNavigation in GetDeclaredSkipNavigations().ToList())
{
if (skipNavigation.TargetEntityType != this)
{
RemoveSkipNavigation(skipNavigation);
}
}
}
_builder = null;
_baseType?._directlyDerivedTypes.Remove(this);
Model.ConventionDispatcher.OnEntityTypeRemoved(Model.Builder, this);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
public virtual ConfigurationSource? GetBaseTypeConfigurationSource()
=> _baseTypeConfigurationSource;
[DebuggerStepThrough]
private void UpdateBaseTypeConfigurationSource(ConfigurationSource configurationSource)
=> _baseTypeConfigurationSource = configurationSource.Max(_baseTypeConfigurationSource);
private readonly SortedSet<EntityType> _directlyDerivedTypes = new(EntityTypeFullNameComparer.Instance);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
// Note this is ISet because there is no suitable readonly interface in the profiles we are using
[DebuggerStepThrough]
public virtual ISet<EntityType> GetDirectlyDerivedTypes()
=> _directlyDerivedTypes;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<EntityType> GetDerivedTypes()
{
if (_directlyDerivedTypes.Count == 0)
{
return Enumerable.Empty<EntityType>();
}
var derivedTypes = new List<EntityType>();
var type = this;
var currentTypeIndex = 0;
while (type != null)
{
derivedTypes.AddRange(type.GetDirectlyDerivedTypes());
type = derivedTypes.Count > currentTypeIndex
? derivedTypes[currentTypeIndex]
: null;
currentTypeIndex++;
}
return derivedTypes;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
public virtual IEnumerable<EntityType> GetDerivedTypesInclusive()
=> _directlyDerivedTypes.Count == 0
? new[] { this }
: new[] { this }.Concat(GetDerivedTypes());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
public virtual IEnumerable<ForeignKey> GetForeignKeysInHierarchy()
=> _directlyDerivedTypes.Count == 0
? GetForeignKeys()
: GetForeignKeys().Concat(GetDerivedForeignKeys());
private bool InheritsFrom(EntityType entityType)
{
var et = this;
do
{
if (entityType == et)
{
return true;
}
}
while ((et = et._baseType) != null);
return false;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
public virtual EntityType RootType()
=> (EntityType)((IReadOnlyEntityType)this).GetRootType();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override string ToString()
=> ((IReadOnlyEntityType)this).ToDebugString(MetadataDebugStringOptions.SingleLineDefault);
/// <summary>
/// Runs the conventions when an annotation was set or removed.
/// </summary>
/// <param name="name"> The key of the set annotation. </param>
/// <param name="annotation"> The annotation set. </param>
/// <param name="oldAnnotation"> The old annotation. </param>
/// <returns> The annotation that was set. </returns>
protected override IConventionAnnotation? OnAnnotationSet(
string name,
IConventionAnnotation? annotation,
IConventionAnnotation? oldAnnotation)
=> Model.ConventionDispatcher.OnEntityTypeAnnotationChanged(Builder, name, annotation, oldAnnotation);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<PropertyBase> GetMembers()
=> GetProperties().Cast<PropertyBase>()
.Concat(GetServiceProperties())
.Concat(GetNavigations())
.Concat(GetSkipNavigations());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<PropertyBase> GetDeclaredMembers()
=> GetDeclaredProperties().Cast<PropertyBase>()
.Concat(GetDeclaredServiceProperties())
.Concat(GetDeclaredNavigations())
.Concat(GetDeclaredSkipNavigations());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<PropertyBase> FindMembersInHierarchy(string name)
=> FindPropertiesInHierarchy(name).Cast<PropertyBase>()
.Concat(FindServicePropertiesInHierarchy(name))
.Concat(FindNavigationsInHierarchy(name))
.Concat(FindSkipNavigationsInHierarchy(name));
#region Primary and Candidate Keys
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? SetPrimaryKey(Property? property, ConfigurationSource configurationSource)
=> SetPrimaryKey(
property == null
? null
: new[] { property }, configurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? SetPrimaryKey(
IReadOnlyList<Property>? properties,
ConfigurationSource configurationSource)
{
EnsureMutable();
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
if (_baseType != null)
{
throw new InvalidOperationException(CoreStrings.DerivedEntityTypeKey(DisplayName(), RootType().DisplayName()));
}
var oldPrimaryKey = _primaryKey;
if (oldPrimaryKey == null && (properties is null || properties.Count == 0))
{
return null;
}
Key? newKey = null;
if (properties?.Count > 0)
{
newKey = FindKey(properties);
if (oldPrimaryKey != null
&& oldPrimaryKey == newKey)
{
UpdatePrimaryKeyConfigurationSource(configurationSource);
newKey.UpdateConfigurationSource(configurationSource);
return newKey;
}
if (newKey == null)
{
newKey = AddKey(properties, configurationSource);
}
}
if (oldPrimaryKey != null)
{
foreach (var property in oldPrimaryKey.Properties)
{
_properties.Remove(property.Name);
property.PrimaryKey = null;
}
_primaryKey = null;
foreach (var property in oldPrimaryKey.Properties)
{
_properties.Add(property.Name, property);
}
}
if (properties?.Count > 0 && newKey != null)
{
foreach (var property in newKey.Properties)
{
_properties.Remove(property.Name);
property.PrimaryKey = newKey;
}
_primaryKey = newKey;
foreach (var property in newKey.Properties)
{
_properties.Add(property.Name, property);
}
UpdatePrimaryKeyConfigurationSource(configurationSource);
}
else
{
SetPrimaryKeyConfigurationSource(null);
}
return (Key?)Model.ConventionDispatcher.OnPrimaryKeyChanged(Builder, newKey, oldPrimaryKey);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? FindPrimaryKey()
=> _baseType?.FindPrimaryKey() ?? _primaryKey;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? FindPrimaryKey(IReadOnlyList<Property>? properties)
{
Check.HasNoNulls(properties, nameof(properties));
Check.NotEmpty(properties, nameof(properties));
if (_baseType != null)
{
return _baseType.FindPrimaryKey(properties);
}
return _primaryKey != null
&& PropertyListComparer.Instance.Compare(_primaryKey.Properties, properties) == 0
? _primaryKey
: null;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ConfigurationSource? GetPrimaryKeyConfigurationSource()
=> _primaryKeyConfigurationSource;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
private void SetPrimaryKeyConfigurationSource(ConfigurationSource? configurationSource)
=> _primaryKeyConfigurationSource = configurationSource;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
private void UpdatePrimaryKeyConfigurationSource(ConfigurationSource configurationSource)
=> _primaryKeyConfigurationSource = configurationSource.Max(_primaryKeyConfigurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? AddKey(Property property, ConfigurationSource configurationSource)
=> AddKey(
new[] { property }, configurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? AddKey(
IReadOnlyList<Property> properties,
ConfigurationSource configurationSource)
{
Check.NotEmpty(properties, nameof(properties));
Check.HasNoNulls(properties, nameof(properties));
EnsureMutable();
if (_baseType != null)
{
throw new InvalidOperationException(CoreStrings.DerivedEntityTypeKey(DisplayName(), _baseType.DisplayName()));
}
if (IsKeyless)
{
throw new InvalidOperationException(CoreStrings.KeylessTypeWithKey(properties.Format(), DisplayName()));
}
for (var i = 0; i < properties.Count; i++)
{
var property = properties[i];
for (var j = i + 1; j < properties.Count; j++)
{
if (property == properties[j])
{
throw new InvalidOperationException(CoreStrings.DuplicatePropertyInKey(properties.Format(), property.Name));
}
}
if (FindProperty(property.Name) != property
|| !property.IsInModel)
{
throw new InvalidOperationException(CoreStrings.KeyPropertiesWrongEntity(properties.Format(), DisplayName()));
}
if (property.IsNullable)
{
throw new InvalidOperationException(CoreStrings.NullableKey(DisplayName(), property.Name));
}
}
var key = FindKey(properties);
if (key != null)
{
throw new InvalidOperationException(
CoreStrings.DuplicateKey(
properties.Format(), DisplayName(), key.DeclaringEntityType.DisplayName()));
}
key = new Key(properties, configurationSource);
_keys.Add(properties, key);
foreach (var property in properties)
{
if (property.Keys == null)
{
property.Keys = new List<Key> { key };
}
else
{
property.Keys.Add(key);
}
}
return (Key?)Model.ConventionDispatcher.OnKeyAdded(key.Builder)?.Metadata;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? FindKey(IReadOnlyProperty property)
=> FindKey(new[] { property });
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? FindKey(IReadOnlyList<IReadOnlyProperty> properties)
{
Check.HasNoNulls(properties, nameof(properties));
Check.NotEmpty(properties, nameof(properties));
return FindDeclaredKey(properties) ?? _baseType?.FindKey(properties);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Key> GetDeclaredKeys()
=> _keys.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? FindDeclaredKey(IReadOnlyList<IReadOnlyProperty> properties)
=> _keys.TryGetValue(Check.NotEmpty(properties, nameof(properties)), out var key)
? key
: null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? RemoveKey(IReadOnlyList<IReadOnlyProperty> properties)
{
Check.NotEmpty(properties, nameof(properties));
var wrongEntityTypeProperty = properties.FirstOrDefault(p => !p.DeclaringEntityType.IsAssignableFrom(this));
if (wrongEntityTypeProperty != null)
{
throw new InvalidOperationException(
CoreStrings.KeyWrongType(
properties.Format(), DisplayName(), wrongEntityTypeProperty.DeclaringEntityType.DisplayName()));
}
var key = FindDeclaredKey(properties);
return key == null
? null
: RemoveKey(key);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Key? RemoveKey(Key key)
{
Check.NotNull(key, nameof(key));
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
EnsureMutable();
if (key.DeclaringEntityType != this)
{
throw new InvalidOperationException(
CoreStrings.KeyWrongType(key.Properties.Format(), DisplayName(), key.DeclaringEntityType.DisplayName()));
}
CheckKeyNotInUse(key);
if (_primaryKey == key)
{
SetPrimaryKey((IReadOnlyList<Property>?)null, ConfigurationSource.Explicit);
_primaryKeyConfigurationSource = null;
}
var removed = _keys.Remove(key.Properties);
Check.DebugAssert(removed, "removed is false");
key.SetRemovedFromModel();
foreach (var property in key.Properties)
{
if (property.Keys != null)
{
property.Keys.Remove(key);
if (property.Keys.Count == 0)
{
property.Keys = null;
}
}
}
return (Key?)Model.ConventionDispatcher.OnKeyRemoved(Builder, key);
}
private void CheckKeyNotInUse(Key key)
{
var foreignKey = key.GetReferencingForeignKeys().FirstOrDefault();
if (foreignKey != null)
{
throw new InvalidOperationException(
CoreStrings.KeyInUse(
key.Properties.Format(),
DisplayName(),
foreignKey.Properties.Format(),
foreignKey.DeclaringEntityType.DisplayName()));
}
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Key> GetKeys()
=> _baseType?.GetKeys().Concat(_keys.Values) ?? _keys.Values;
#endregion
#region Foreign Keys
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? AddForeignKey(
Property property,
Key principalKey,
EntityType principalEntityType,
ConfigurationSource? componentConfigurationSource,
ConfigurationSource configurationSource)
=> AddForeignKey(
new[] { property }, principalKey, principalEntityType, componentConfigurationSource, configurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? AddForeignKey(
IReadOnlyList<Property> properties,
Key principalKey,
EntityType principalEntityType,
ConfigurationSource? componentConfigurationSource,
ConfigurationSource configurationSource)
{
Check.NotEmpty(properties, nameof(properties));
Check.HasNoNulls(properties, nameof(properties));
Check.NotNull(principalKey, nameof(principalKey));
Check.NotNull(principalEntityType, nameof(principalEntityType));
EnsureMutable();
var foreignKey = new ForeignKey(
properties, principalKey, this, principalEntityType, configurationSource);
principalEntityType.UpdateConfigurationSource(configurationSource);
if (componentConfigurationSource.HasValue)
{
foreignKey.UpdatePropertiesConfigurationSource(componentConfigurationSource.Value);
foreignKey.UpdatePrincipalKeyConfigurationSource(componentConfigurationSource.Value);
foreignKey.UpdatePrincipalEndConfigurationSource(componentConfigurationSource.Value);
}
OnForeignKeyUpdated(foreignKey);
return (ForeignKey?)Model.ConventionDispatcher.OnForeignKeyAdded(foreignKey.Builder)?.Metadata;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual void OnForeignKeyUpdating(ForeignKey foreignKey)
{
var removed = _foreignKeys.Remove(foreignKey);
Check.DebugAssert(removed, "removed is false");
foreach (var property in foreignKey.Properties)
{
if (property.ForeignKeys != null)
{
property.ForeignKeys.Remove(foreignKey);
if (property.ForeignKeys.Count == 0)
{
property.ForeignKeys = null;
}
}
}
removed = foreignKey.PrincipalKey.ReferencingForeignKeys!.Remove(foreignKey);
Check.DebugAssert(removed, "removed is false");
removed = foreignKey.PrincipalEntityType.DeclaredReferencingForeignKeys!.Remove(foreignKey);
Check.DebugAssert(removed, "removed is false");
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual void OnForeignKeyUpdated(ForeignKey foreignKey)
{
var added = _foreignKeys.Add(foreignKey);
Check.DebugAssert(added, "added is false");
foreach (var property in foreignKey.Properties)
{
if (property.ForeignKeys == null)
{
property.ForeignKeys = new List<ForeignKey> { foreignKey };
}
else
{
property.ForeignKeys.Add(foreignKey);
}
}
var principalKey = foreignKey.PrincipalKey;
if (principalKey.ReferencingForeignKeys == null)
{
principalKey.ReferencingForeignKeys = new SortedSet<ForeignKey>(ForeignKeyComparer.Instance) { foreignKey };
}
else
{
added = principalKey.ReferencingForeignKeys.Add(foreignKey);
Check.DebugAssert(added, "added is false");
}
var principalEntityType = foreignKey.PrincipalEntityType;
if (principalEntityType.DeclaredReferencingForeignKeys == null)
{
principalEntityType.DeclaredReferencingForeignKeys = new SortedSet<ForeignKey>(ForeignKeyComparer.Instance) { foreignKey };
}
else
{
added = principalEntityType.DeclaredReferencingForeignKeys.Add(foreignKey);
Check.DebugAssert(added, "added is false");
}
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> FindForeignKeys(IReadOnlyProperty property)
=> FindForeignKeys(new[] { property });
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> FindForeignKeys(IReadOnlyList<IReadOnlyProperty> properties)
{
Check.HasNoNulls(properties, nameof(properties));
Check.NotEmpty(properties, nameof(properties));
return _baseType != null
? _foreignKeys.Count == 0
? _baseType.FindForeignKeys(properties)
: _baseType.FindForeignKeys(properties).Concat(FindDeclaredForeignKeys(properties))
: FindDeclaredForeignKeys(properties);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? FindForeignKey(
IReadOnlyProperty property,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
=> FindForeignKey(
new[] { property }, principalKey, principalEntityType);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? FindForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
{
Check.HasNoNulls(properties, nameof(properties));
Check.NotEmpty(properties, nameof(properties));
Check.NotNull(principalKey, nameof(principalKey));
Check.NotNull(principalEntityType, nameof(principalEntityType));
return FindDeclaredForeignKey(properties, principalKey, principalEntityType)
?? _baseType?.FindForeignKey(properties, principalKey, principalEntityType);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? FindOwnership()
{
foreach (var foreignKey in GetForeignKeys())
{
if (foreignKey.IsOwnership)
{
return foreignKey;
}
}
return null;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? FindDeclaredOwnership()
{
foreach (var foreignKey in _foreignKeys)
{
if (foreignKey.IsOwnership)
{
return foreignKey;
}
}
return null;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> GetDeclaredForeignKeys()
=> _foreignKeys;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> GetDerivedForeignKeys()
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<ForeignKey>()
: GetDerivedTypes().SelectMany(et => et._foreignKeys);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> GetForeignKeys()
=> _baseType != null
? _foreignKeys.Count == 0
? _baseType.GetForeignKeys()
: _baseType.GetForeignKeys().Concat(_foreignKeys)
: _foreignKeys;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> FindDeclaredForeignKeys(IReadOnlyList<IReadOnlyProperty> properties)
{
Check.NotEmpty(properties, nameof(properties));
return _foreignKeys.Count == 0
? Enumerable.Empty<ForeignKey>()
: _foreignKeys.Where(fk => PropertyListComparer.Instance.Equals(fk.Properties, properties));
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? FindDeclaredForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
{
Check.NotEmpty(properties, nameof(properties));
Check.NotNull(principalKey, nameof(principalKey));
Check.NotNull(principalEntityType, nameof(principalEntityType));
if (_foreignKeys.Count == 0)
{
return null;
}
foreach (var fk in FindDeclaredForeignKeys(properties))
{
if (PropertyListComparer.Instance.Equals(fk.PrincipalKey.Properties, principalKey.Properties)
&& fk.PrincipalEntityType == principalEntityType)
{
return fk;
}
}
return null;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> FindDerivedForeignKeys(
IReadOnlyList<IReadOnlyProperty> properties)
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<ForeignKey>()
: GetDerivedTypes().SelectMany(et => et.FindDeclaredForeignKeys(properties));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> FindDerivedForeignKeys(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<ForeignKey>()
: (IEnumerable<ForeignKey>)GetDerivedTypes().Select(et => et.FindDeclaredForeignKey(properties, principalKey, principalEntityType))
.Where(fk => fk != null);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> FindForeignKeysInHierarchy(
IReadOnlyList<IReadOnlyProperty> properties)
=> _directlyDerivedTypes.Count == 0
? FindForeignKeys(properties)
: FindForeignKeys(properties).Concat(FindDerivedForeignKeys(properties));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> FindForeignKeysInHierarchy(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindForeignKey(properties, principalKey, principalEntityType))
: ToEnumerable(FindForeignKey(properties, principalKey, principalEntityType))
.Concat(FindDerivedForeignKeys(properties, principalKey, principalEntityType));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? RemoveForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
{
Check.NotEmpty(properties, nameof(properties));
var foreignKey = FindDeclaredForeignKey(properties, principalKey, principalEntityType);
return foreignKey == null
? null
: RemoveForeignKey(foreignKey);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ForeignKey? RemoveForeignKey(ForeignKey foreignKey)
{
Check.NotNull(foreignKey, nameof(foreignKey));
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
EnsureMutable();
if (foreignKey.DeclaringEntityType != this)
{
throw new InvalidOperationException(
CoreStrings.ForeignKeyWrongType(
foreignKey.Properties.Format(),
foreignKey.PrincipalKey.Properties.Format(),
foreignKey.PrincipalEntityType.DisplayName(),
DisplayName(),
foreignKey.DeclaringEntityType.DisplayName()));
}
var referencingSkipNavigation = foreignKey.ReferencingSkipNavigations?.FirstOrDefault();
if (referencingSkipNavigation != null)
{
throw new InvalidOperationException(
CoreStrings.ForeignKeyInUseSkipNavigation(
foreignKey.Properties.Format(),
DisplayName(),
referencingSkipNavigation.Name,
referencingSkipNavigation.DeclaringEntityType.DisplayName()));
}
if (foreignKey.DependentToPrincipal != null)
{
foreignKey.DeclaringEntityType.RemoveNavigation(foreignKey.DependentToPrincipal.Name);
}
if (foreignKey.PrincipalToDependent != null)
{
foreignKey.PrincipalEntityType.RemoveNavigation(foreignKey.PrincipalToDependent.Name);
}
OnForeignKeyUpdating(foreignKey);
foreignKey.SetRemovedFromModel();
if (foreignKey.DependentToPrincipal != null)
{
foreignKey.DependentToPrincipal.SetRemovedFromModel();
Model.ConventionDispatcher.OnNavigationRemoved(
Builder,
foreignKey.PrincipalEntityType.Builder,
foreignKey.DependentToPrincipal.Name,
foreignKey.DependentToPrincipal.GetIdentifyingMemberInfo());
}
if (foreignKey.PrincipalToDependent != null)
{
foreignKey.PrincipalToDependent.SetRemovedFromModel();
Model.ConventionDispatcher.OnNavigationRemoved(
foreignKey.PrincipalEntityType.Builder,
Builder,
foreignKey.PrincipalToDependent.Name,
foreignKey.PrincipalToDependent.GetIdentifyingMemberInfo());
}
return (ForeignKey?)Model.ConventionDispatcher.OnForeignKeyRemoved(Builder, foreignKey);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> GetReferencingForeignKeys()
=> _baseType != null
? (DeclaredReferencingForeignKeys?.Count ?? 0) == 0
? _baseType.GetReferencingForeignKeys()
: _baseType.GetReferencingForeignKeys().Concat(GetDeclaredReferencingForeignKeys())
: GetDeclaredReferencingForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ForeignKey> GetDeclaredReferencingForeignKeys()
=> DeclaredReferencingForeignKeys ?? Enumerable.Empty<ForeignKey>();
private SortedSet<ForeignKey>? DeclaredReferencingForeignKeys { get; set; }
#endregion
#region Navigations
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Navigation AddNavigation(
string name,
ForeignKey foreignKey,
bool pointsToPrincipal)
{
Check.NotEmpty(name, nameof(name));
Check.NotNull(foreignKey, nameof(foreignKey));
return AddNavigation(new MemberIdentity(name), foreignKey, pointsToPrincipal);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Navigation AddNavigation(
MemberInfo navigationMember,
ForeignKey foreignKey,
bool pointsToPrincipal)
{
Check.NotNull(navigationMember, nameof(navigationMember));
Check.NotNull(foreignKey, nameof(foreignKey));
return AddNavigation(new MemberIdentity(navigationMember), foreignKey, pointsToPrincipal);
}
private Navigation AddNavigation(MemberIdentity navigationMember, ForeignKey foreignKey, bool pointsToPrincipal)
{
EnsureMutable();
var name = navigationMember.Name!;
var duplicateNavigation = FindNavigationsInHierarchy(name).FirstOrDefault();
if (duplicateNavigation != null)
{
if (duplicateNavigation.ForeignKey != foreignKey)
{
throw new InvalidOperationException(
CoreStrings.NavigationForWrongForeignKey(
duplicateNavigation.Name,
duplicateNavigation.DeclaringEntityType.DisplayName(),
foreignKey.Properties.Format(),
duplicateNavigation.ForeignKey.Properties.Format()));
}
throw new InvalidOperationException(
CoreStrings.ConflictingPropertyOrNavigation(
name, DisplayName(), duplicateNavigation.DeclaringEntityType.DisplayName()));
}
var duplicateProperty = FindMembersInHierarchy(name).FirstOrDefault();
if (duplicateProperty != null)
{
throw new InvalidOperationException(
CoreStrings.ConflictingPropertyOrNavigation(
name, DisplayName(), ((IReadOnlyTypeBase)duplicateProperty.DeclaringType).DisplayName()));
}
Check.DebugAssert(
!GetNavigations().Any(n => n.ForeignKey == foreignKey && n.IsOnDependent == pointsToPrincipal),
"There is another navigation corresponding to the same foreign key and pointing in the same direction.");
Check.DebugAssert(
(pointsToPrincipal ? foreignKey.DeclaringEntityType : foreignKey.PrincipalEntityType) == this,
"EntityType mismatch");
var memberInfo = navigationMember.MemberInfo;
if (memberInfo != null)
{
ValidateClrMember(name, memberInfo);
}
else
{
memberInfo = ClrType.GetMembersInHierarchy(name).FirstOrDefault();
}
if (memberInfo != null)
{
Navigation.IsCompatible(
name,
memberInfo,
this,
pointsToPrincipal ? foreignKey.PrincipalEntityType : foreignKey.DeclaringEntityType,
!pointsToPrincipal && !foreignKey.IsUnique,
shouldThrow: true);
}
var navigation = new Navigation(name, memberInfo as PropertyInfo, memberInfo as FieldInfo, foreignKey);
_navigations.Add(name, navigation);
return navigation;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Navigation? FindNavigation(string name)
=> (Navigation?)((IReadOnlyEntityType)this).FindNavigation(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Navigation? FindNavigation(MemberInfo memberInfo)
=> (Navigation?)((IReadOnlyEntityType)this).FindNavigation(Check.NotNull(memberInfo, nameof(memberInfo)).GetSimpleMemberName());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Navigation? FindDeclaredNavigation(string name)
=> _navigations.TryGetValue(Check.NotEmpty(name, nameof(name)), out var navigation)
? navigation
: null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Navigation> GetDeclaredNavigations()
=> _navigations.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Navigation> GetDerivedNavigations()
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<Navigation>()
: GetDerivedTypes().SelectMany(et => et.GetDeclaredNavigations());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Navigation> FindDerivedNavigations(string name)
{
Check.NotNull(name, nameof(name));
return _directlyDerivedTypes.Count == 0
? Enumerable.Empty<Navigation>()
: (IEnumerable<Navigation>)GetDerivedTypes().Select(et => et.FindDeclaredNavigation(name)).Where(n => n != null);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Navigation> FindNavigationsInHierarchy(string name)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindNavigation(name))
: ToEnumerable(FindNavigation(name)).Concat(FindDerivedNavigations(name));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Navigation? RemoveNavigation(string name)
{
Check.NotEmpty(name, nameof(name));
EnsureMutable();
var navigation = FindDeclaredNavigation(name);
if (navigation == null)
{
return null;
}
_navigations.Remove(name);
return navigation;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Navigation> GetNavigations()
=> _baseType != null
? _navigations.Count == 0 ? _baseType.GetNavigations() : _baseType.GetNavigations().Concat(_navigations.Values)
: _navigations.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual SkipNavigation? AddSkipNavigation(
string name,
MemberInfo? memberInfo,
EntityType targetEntityType,
bool collection,
bool onDependent,
ConfigurationSource configurationSource)
{
Check.NotEmpty(name, nameof(name));
Check.NotNull(targetEntityType, nameof(targetEntityType));
EnsureMutable();
var duplicateProperty = FindMembersInHierarchy(name).FirstOrDefault();
if (duplicateProperty != null)
{
throw new InvalidOperationException(
CoreStrings.ConflictingPropertyOrNavigation(
name, DisplayName(), ((IReadOnlyTypeBase)duplicateProperty.DeclaringType).DisplayName()));
}
if (memberInfo != null)
{
ValidateClrMember(name, memberInfo);
}
else
{
memberInfo = ClrType.GetMembersInHierarchy(name).FirstOrDefault();
}
if (memberInfo != null)
{
Navigation.IsCompatible(
name,
memberInfo,
this,
targetEntityType,
collection,
shouldThrow: true);
}
var skipNavigation = new SkipNavigation(
name,
memberInfo as PropertyInfo,
memberInfo as FieldInfo,
this,
targetEntityType,
collection,
onDependent,
configurationSource);
_skipNavigations.Add(name, skipNavigation);
if (targetEntityType.DeclaredReferencingSkipNavigations == null)
{
targetEntityType.DeclaredReferencingSkipNavigations =
new SortedSet<SkipNavigation>(SkipNavigationComparer.Instance) { skipNavigation };
}
else
{
var added = targetEntityType.DeclaredReferencingSkipNavigations.Add(skipNavigation);
Check.DebugAssert(added, "added is false");
}
return (SkipNavigation?)Model.ConventionDispatcher.OnSkipNavigationAdded(skipNavigation.Builder)?.Metadata;
}
private Type? ValidateClrMember(string name, MemberInfo memberInfo, bool throwOnNameMismatch = true)
{
if (name != memberInfo.GetSimpleMemberName())
{
if (memberInfo != FindIndexerPropertyInfo())
{
if (throwOnNameMismatch)
{
throw new InvalidOperationException(
CoreStrings.PropertyWrongName(
name,
DisplayName(),
memberInfo.GetSimpleMemberName()));
}
return memberInfo.GetMemberType();
}
var clashingMemberInfo = ClrType.GetMembersInHierarchy(name).FirstOrDefault();
if (clashingMemberInfo != null)
{
throw new InvalidOperationException(
CoreStrings.PropertyClashingNonIndexer(
name,
DisplayName()));
}
}
return null;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual SkipNavigation? FindSkipNavigation(string name)
{
Check.NotEmpty(name, nameof(name));
return FindDeclaredSkipNavigation(name) ?? _baseType?.FindSkipNavigation(name);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual SkipNavigation? FindSkipNavigation(MemberInfo memberInfo)
=> FindSkipNavigation(Check.NotNull(memberInfo, nameof(memberInfo)).GetSimpleMemberName());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual SkipNavigation? FindDeclaredSkipNavigation(string name)
=> _skipNavigations.TryGetValue(Check.NotEmpty(name, nameof(name)), out var navigation)
? navigation
: null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> GetDeclaredSkipNavigations()
=> _skipNavigations.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> GetDerivedSkipNavigations()
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<SkipNavigation>()
: GetDerivedTypes().SelectMany(et => et.GetDeclaredSkipNavigations());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> FindDerivedSkipNavigations(string name)
{
Check.NotNull(name, nameof(name));
return _directlyDerivedTypes.Count == 0
? Enumerable.Empty<SkipNavigation>()
: (IEnumerable<SkipNavigation>)GetDerivedTypes().Select(et => et.FindDeclaredSkipNavigation(name)).Where(n => n != null);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> FindDerivedSkipNavigationsInclusive(string name)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindDeclaredSkipNavigation(name))
: ToEnumerable(FindDeclaredSkipNavigation(name)).Concat(FindDerivedSkipNavigations(name));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> FindSkipNavigationsInHierarchy(string name)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindSkipNavigation(name))
: ToEnumerable(FindSkipNavigation(name)).Concat(FindDerivedSkipNavigations(name));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual SkipNavigation? RemoveSkipNavigation(string name)
{
Check.NotEmpty(name, nameof(name));
var navigation = FindDeclaredSkipNavigation(name);
return navigation == null ? null : RemoveSkipNavigation(navigation);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual SkipNavigation? RemoveSkipNavigation(SkipNavigation navigation)
{
Check.NotNull(navigation, nameof(navigation));
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
EnsureMutable();
if (navigation.DeclaringEntityType != this)
{
throw new InvalidOperationException(
CoreStrings.SkipNavigationWrongType(
navigation.Name, DisplayName(), navigation.DeclaringEntityType.DisplayName()));
}
if (navigation.Inverse?.Inverse == navigation)
{
throw new InvalidOperationException(
CoreStrings.SkipNavigationInUseBySkipNavigation(
navigation.DeclaringEntityType.DisplayName(),
navigation.Name,
navigation.Inverse.DeclaringEntityType.DisplayName(),
navigation.Inverse.Name));
}
var removed = _skipNavigations.Remove(navigation.Name);
Check.DebugAssert(removed, "Expected the navigation to be removed");
removed = navigation.ForeignKey is ForeignKey foreignKey
? foreignKey.ReferencingSkipNavigations!.Remove(navigation)
: true;
Check.DebugAssert(removed, "removed is false");
removed = navigation.TargetEntityType.DeclaredReferencingSkipNavigations!.Remove(navigation);
Check.DebugAssert(removed, "removed is false");
navigation.SetRemovedFromModel();
return (SkipNavigation?)Model.ConventionDispatcher.OnSkipNavigationRemoved(Builder, navigation);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> GetSkipNavigations()
=> _baseType != null
? _skipNavigations.Count == 0
? _baseType.GetSkipNavigations()
: _baseType.GetSkipNavigations().Concat(_skipNavigations.Values)
: _skipNavigations.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> GetReferencingSkipNavigations()
=> _baseType != null
? (DeclaredReferencingSkipNavigations?.Count ?? 0) == 0
? _baseType.GetReferencingSkipNavigations()
: _baseType.GetReferencingSkipNavigations().Concat(GetDeclaredReferencingSkipNavigations())
: GetDeclaredReferencingSkipNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> GetDeclaredReferencingSkipNavigations()
=> DeclaredReferencingSkipNavigations ?? Enumerable.Empty<SkipNavigation>();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<SkipNavigation> GetDerivedReferencingSkipNavigations()
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<SkipNavigation>()
: GetDerivedTypes().SelectMany(et => et.GetDeclaredReferencingSkipNavigations());
private SortedSet<SkipNavigation>? DeclaredReferencingSkipNavigations { get; set; }
#endregion
#region Indexes
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? AddIndex(
Property property,
ConfigurationSource configurationSource)
=> AddIndex(new[] { property }, configurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? AddIndex(
Property property,
string name,
ConfigurationSource configurationSource)
=> AddIndex(new[] { property }, name, configurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? AddIndex(
IReadOnlyList<Property> properties,
ConfigurationSource configurationSource)
{
Check.NotEmpty(properties, nameof(properties));
Check.HasNoNulls(properties, nameof(properties));
EnsureMutable();
CheckIndexProperties(properties);
var duplicateIndex = FindIndexesInHierarchy(properties).FirstOrDefault();
if (duplicateIndex != null)
{
throw new InvalidOperationException(
CoreStrings.DuplicateIndex(properties.Format(), DisplayName(), duplicateIndex.DeclaringEntityType.DisplayName()));
}
var index = new Index(properties, this, configurationSource);
_unnamedIndexes.Add(properties, index);
UpdatePropertyIndexes(properties, index);
return (Index?)Model.ConventionDispatcher.OnIndexAdded(index.Builder)?.Metadata;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? AddIndex(
IReadOnlyList<Property> properties,
string name,
ConfigurationSource configurationSource)
{
Check.NotEmpty(properties, nameof(properties));
Check.HasNoNulls(properties, nameof(properties));
Check.NotEmpty(name, nameof(name));
EnsureMutable();
CheckIndexProperties(properties);
var duplicateIndex = FindIndexesInHierarchy(name).FirstOrDefault();
if (duplicateIndex != null)
{
throw new InvalidOperationException(
CoreStrings.DuplicateNamedIndex(
name,
properties.Format(),
DisplayName(),
duplicateIndex.DeclaringEntityType.DisplayName()));
}
var index = new Index(properties, name, this, configurationSource);
_namedIndexes.Add(name, index);
UpdatePropertyIndexes(properties, index);
return (Index?)Model.ConventionDispatcher.OnIndexAdded(index.Builder)?.Metadata;
}
private void CheckIndexProperties(IReadOnlyList<Property> properties)
{
for (var i = 0; i < properties.Count; i++)
{
var property = properties[i];
for (var j = i + 1; j < properties.Count; j++)
{
if (property == properties[j])
{
throw new InvalidOperationException(CoreStrings.DuplicatePropertyInIndex(properties.Format(), property.Name));
}
}
if (FindProperty(property.Name) != property
|| !property.IsInModel)
{
throw new InvalidOperationException(CoreStrings.IndexPropertiesWrongEntity(properties.Format(), DisplayName()));
}
}
}
private void UpdatePropertyIndexes(IReadOnlyList<Property> properties, Index index)
{
foreach (var property in properties)
{
if (property.Indexes == null)
{
property.Indexes = new List<Index> { index };
}
else
{
property.Indexes.Add(index);
}
}
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? FindIndex(IReadOnlyProperty property)
=> FindIndex(new[] { property });
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? FindIndex(IReadOnlyList<IReadOnlyProperty> properties)
{
Check.HasNoNulls(properties, nameof(properties));
Check.NotEmpty(properties, nameof(properties));
return FindDeclaredIndex(properties) ?? _baseType?.FindIndex(properties);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? FindIndex(string name)
{
Check.NotEmpty(name, nameof(name));
return FindDeclaredIndex(name) ?? _baseType?.FindIndex(name);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Index> GetDeclaredIndexes()
=> _namedIndexes.Count == 0
? _unnamedIndexes.Values
: _unnamedIndexes.Values.Concat(_namedIndexes.Values);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Index> GetDerivedIndexes()
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<Index>()
: GetDerivedTypes().SelectMany(et => et.GetDeclaredIndexes());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? FindDeclaredIndex(IReadOnlyList<IReadOnlyProperty> properties)
=> _unnamedIndexes.TryGetValue(Check.NotEmpty(properties, nameof(properties)), out var index)
? index
: null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? FindDeclaredIndex(string name)
=> _namedIndexes.TryGetValue(Check.NotEmpty(name, nameof(name)), out var index)
? index
: null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Index> FindDerivedIndexes(IReadOnlyList<IReadOnlyProperty> properties)
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<Index>()
: (IEnumerable<Index>)GetDerivedTypes().Select(et => et.FindDeclaredIndex(properties)).Where(i => i != null);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Index> FindDerivedIndexes(string name)
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<Index>()
: (IEnumerable<Index>)GetDerivedTypes()
.Select(et => et.FindDeclaredIndex(Check.NotEmpty(name, nameof(name))))
.Where(i => i != null);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Index> FindIndexesInHierarchy(IReadOnlyList<IReadOnlyProperty> properties)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindIndex(properties))
: ToEnumerable(FindIndex(properties)).Concat(FindDerivedIndexes(properties));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Index> FindIndexesInHierarchy(string name)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindIndex(Check.NotEmpty(name, nameof(name))))
: ToEnumerable(FindIndex(Check.NotEmpty(name, nameof(name)))).Concat(FindDerivedIndexes(name));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? RemoveIndex(IReadOnlyList<IReadOnlyProperty> properties)
{
Check.NotEmpty(properties, nameof(properties));
var index = FindDeclaredIndex(properties);
return index == null
? null
: RemoveIndex(index);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? RemoveIndex(string name)
{
Check.NotEmpty(name, nameof(name));
var index = FindDeclaredIndex(name);
return index == null
? null
: RemoveIndex(index);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Index? RemoveIndex(Index index)
{
Check.NotNull(index, nameof(index));
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
EnsureMutable();
if (index.Name == null)
{
if (!_unnamedIndexes.Remove(index.Properties))
{
throw new InvalidOperationException(
CoreStrings.IndexWrongType(index.Properties.Format(), DisplayName(), index.DeclaringEntityType.DisplayName()));
}
}
else
{
if (!_namedIndexes.Remove(index.Name))
{
throw new InvalidOperationException(
CoreStrings.NamedIndexWrongType(index.Name, DisplayName()));
}
}
index.SetRemovedFromModel();
foreach (var property in index.Properties)
{
if (property.Indexes != null)
{
property.Indexes.Remove(index);
if (property.Indexes.Count == 0)
{
property.Indexes = null;
}
}
}
return (Index?)Model.ConventionDispatcher.OnIndexRemoved(Builder, index);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Index> GetIndexes()
=> _baseType != null
? _namedIndexes.Count == 0 && _unnamedIndexes.Count == 0
? _baseType.GetIndexes()
: _baseType.GetIndexes().Concat(GetDeclaredIndexes())
: GetDeclaredIndexes();
#endregion
#region Properties
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? AddProperty(
string name,
Type propertyType,
ConfigurationSource? typeConfigurationSource,
ConfigurationSource configurationSource)
{
Check.NotNull(name, nameof(name));
Check.NotNull(propertyType, nameof(propertyType));
return AddProperty(
name,
propertyType,
ClrType.GetMembersInHierarchy(name).FirstOrDefault(),
typeConfigurationSource,
configurationSource);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? AddProperty(
MemberInfo memberInfo,
ConfigurationSource configurationSource)
=> AddProperty(
memberInfo.GetSimpleMemberName(),
memberInfo.GetMemberType(),
memberInfo,
configurationSource,
configurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? AddProperty(
string name,
ConfigurationSource configurationSource)
{
var clrMember = ClrType.GetMembersInHierarchy(name).FirstOrDefault();
if (clrMember == null)
{
throw new InvalidOperationException(CoreStrings.NoPropertyType(name, DisplayName()));
}
return AddProperty(clrMember, configurationSource);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? AddProperty(
string name,
Type propertyType,
MemberInfo? memberInfo,
ConfigurationSource? typeConfigurationSource,
ConfigurationSource configurationSource)
{
Check.NotNull(name, nameof(name));
Check.NotNull(propertyType, nameof(propertyType));
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
EnsureMutable();
var conflictingMember = FindMembersInHierarchy(name).FirstOrDefault();
if (conflictingMember != null)
{
throw new InvalidOperationException(
CoreStrings.ConflictingPropertyOrNavigation(
name, DisplayName(),
((IReadOnlyTypeBase)conflictingMember.DeclaringType).DisplayName()));
}
if (memberInfo != null)
{
propertyType = ValidateClrMember(name, memberInfo, typeConfigurationSource != null)
?? propertyType;
if (memberInfo.DeclaringType?.IsAssignableFrom(ClrType) != true)
{
throw new InvalidOperationException(CoreStrings.PropertyWrongEntityClrType(
memberInfo.Name, DisplayName(), memberInfo.DeclaringType?.ShortDisplayName()));
}
}
else if (IsPropertyBag)
{
memberInfo = FindIndexerPropertyInfo();
}
else
{
Check.DebugAssert(
ClrType.GetMembersInHierarchy(name).FirstOrDefault() == null,
"MemberInfo not supplied for non-shadow property");
}
if (memberInfo != null
&& propertyType != memberInfo.GetMemberType()
&& memberInfo != FindIndexerPropertyInfo())
{
if (typeConfigurationSource != null)
{
throw new InvalidOperationException(
CoreStrings.PropertyWrongClrType(
name,
DisplayName(),
memberInfo.GetMemberType().ShortDisplayName(),
propertyType.ShortDisplayName()));
}
propertyType = memberInfo.GetMemberType();
}
var property = new Property(
name, propertyType, memberInfo as PropertyInfo, memberInfo as FieldInfo, this,
configurationSource, typeConfigurationSource);
_properties.Add(property.Name, property);
return (Property?)Model.ConventionDispatcher.OnPropertyAdded(property.Builder)?.Metadata;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? FindProperty(string name)
=> FindDeclaredProperty(Check.NotEmpty(name, nameof(name))) ?? _baseType?.FindProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? FindDeclaredProperty(string name)
=> _properties.TryGetValue(Check.NotEmpty(name, nameof(name)), out var property)
? property
: null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Property> GetDeclaredProperties()
=> _properties.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Property> GetDerivedProperties()
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<Property>()
: GetDerivedTypes().SelectMany(et => et.GetDeclaredProperties());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Property> FindDerivedProperties(string propertyName)
{
Check.NotNull(propertyName, nameof(propertyName));
return _directlyDerivedTypes.Count == 0
? Enumerable.Empty<Property>()
: (IEnumerable<Property>)GetDerivedTypes().Select(et => et.FindDeclaredProperty(propertyName)).Where(p => p != null);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Property> FindDerivedPropertiesInclusive(string propertyName)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindDeclaredProperty(propertyName))
: ToEnumerable(FindDeclaredProperty(propertyName)).Concat(FindDerivedProperties(propertyName));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Property> FindPropertiesInHierarchy(string propertyName)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindProperty(propertyName))
: ToEnumerable(FindProperty(propertyName)).Concat(FindDerivedProperties(propertyName));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IReadOnlyList<Property>? FindProperties(IReadOnlyList<string> propertyNames)
{
Check.NotNull(propertyNames, nameof(propertyNames));
var properties = new List<Property>(propertyNames.Count);
foreach (var propertyName in propertyNames)
{
var property = FindProperty(propertyName);
if (property == null)
{
return null;
}
properties.Add(property);
}
return properties;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? RemoveProperty(string name)
{
Check.NotEmpty(name, nameof(name));
var property = FindDeclaredProperty(name);
return property == null
? null
: RemoveProperty(property);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? RemoveProperty(Property property)
{
Check.NotNull(property, nameof(property));
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
EnsureMutable();
if (property.DeclaringEntityType != this)
{
throw new InvalidOperationException(
CoreStrings.PropertyWrongType(
property.Name,
DisplayName(),
property.DeclaringEntityType.DisplayName()));
}
CheckPropertyNotInUse(property);
var removed = _properties.Remove(property.Name);
Check.DebugAssert(removed, "removed is false");
property.SetRemovedFromModel();
return (Property?)Model.ConventionDispatcher.OnPropertyRemoved(Builder, property);
}
private void CheckPropertyNotInUse(Property property)
{
var containingKey = property.Keys?.FirstOrDefault();
if (containingKey != null)
{
throw new InvalidOperationException(
CoreStrings.PropertyInUseKey(property.Name, DisplayName(), containingKey.Properties.Format()));
}
var containingForeignKey = property.ForeignKeys?.FirstOrDefault();
if (containingForeignKey != null)
{
throw new InvalidOperationException(
CoreStrings.PropertyInUseForeignKey(
property.Name, DisplayName(),
containingForeignKey.Properties.Format(), containingForeignKey.DeclaringEntityType.DisplayName()));
}
var containingIndex = property.Indexes?.FirstOrDefault();
if (containingIndex != null)
{
throw new InvalidOperationException(
CoreStrings.PropertyInUseIndex(
property.Name, DisplayName(),
containingIndex.Properties.Format(), containingIndex.DeclaringEntityType.DisplayName()));
}
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<Property> GetProperties()
=> _baseType != null
? _baseType.GetProperties().Concat(_properties.Values)
: _properties.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual PropertyCounts Counts
=> NonCapturingLazyInitializer.EnsureInitialized(ref _counts, this, static entityType =>
{
entityType.EnsureReadOnly();
return entityType.CalculateCounts();
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Func<InternalEntityEntry, ISnapshot> RelationshipSnapshotFactory
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _relationshipSnapshotFactory, this,
static entityType =>
{
entityType.EnsureReadOnly();
return new RelationshipSnapshotFactoryFactory().Create(entityType);
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Func<InternalEntityEntry, ISnapshot> OriginalValuesFactory
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _originalValuesFactory, this,
static entityType =>
{
entityType.EnsureReadOnly();
return new OriginalValuesFactoryFactory().Create(entityType);
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Func<InternalEntityEntry, ISnapshot> StoreGeneratedValuesFactory
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _storeGeneratedValuesFactory, this,
static entityType =>
{
entityType.EnsureReadOnly();
return new SidecarValuesFactoryFactory().Create(entityType);
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Func<InternalEntityEntry, ISnapshot> TemporaryValuesFactory
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _temporaryValuesFactory, this,
static entityType =>
{
entityType.EnsureReadOnly();
return new TemporaryValuesFactoryFactory().Create(entityType);
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Func<ValueBuffer, ISnapshot> ShadowValuesFactory
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _shadowValuesFactory, this,
static entityType =>
{
entityType.EnsureReadOnly();
return new ShadowValuesFactoryFactory().Create(entityType);
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Func<ISnapshot> EmptyShadowValuesFactory
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _emptyShadowValuesFactory, this,
static entityType =>
{
entityType.EnsureReadOnly();
return new EmptyShadowValuesFactoryFactory().CreateEmpty(entityType);
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Func<MaterializationContext, object> InstanceFactory
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _instanceFactory, this,
static entityType =>
{
entityType.EnsureReadOnly();
var binding = entityType.ServiceOnlyConstructorBinding;
if (binding == null)
{
var _ = entityType.ConstructorBinding;
binding = entityType.ServiceOnlyConstructorBinding;
if (binding == null)
{
throw new InvalidOperationException(CoreStrings.NoParameterlessConstructor(entityType.DisplayName()));
}
}
var contextParam = Expression.Parameter(typeof(MaterializationContext), "mc");
return Expression.Lambda<Func<MaterializationContext, object>>(
binding.CreateConstructorExpression(
new ParameterBindingInfo(entityType, contextParam)),
contextParam)
.Compile();
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IReadOnlyList<IProperty> ForeignKeyProperties
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _foreignKeyProperties, this,
static entityType =>
{
entityType.EnsureReadOnly();
return entityType.GetProperties().Where(p => p.IsForeignKey()).ToArray();
});
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IReadOnlyList<IProperty> ValueGeneratingProperties
=> NonCapturingLazyInitializer.EnsureInitialized(
ref _valueGeneratingProperties, this,
static entityType =>
{
entityType.EnsureReadOnly();
return entityType.GetProperties().Where(p => p.RequiresValueGenerator()).ToArray();
});
#endregion
#region Service properties
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ServiceProperty AddServiceProperty(
MemberInfo memberInfo,
// ReSharper disable once MethodOverloadWithOptionalParameter
ConfigurationSource configurationSource)
{
Check.NotNull(memberInfo, nameof(memberInfo));
EnsureMutable();
var name = memberInfo.GetSimpleMemberName();
var duplicateMember = FindMembersInHierarchy(name).FirstOrDefault();
if (duplicateMember != null)
{
throw new InvalidOperationException(
CoreStrings.ConflictingPropertyOrNavigation(
name, DisplayName(),
((IReadOnlyTypeBase)duplicateMember.DeclaringType).DisplayName()));
}
ValidateClrMember(name, memberInfo, false);
var serviceProperty = new ServiceProperty(
name,
memberInfo as PropertyInfo,
memberInfo as FieldInfo,
this,
configurationSource);
var duplicateServiceProperty = GetServiceProperties().FirstOrDefault(p => p.ClrType == serviceProperty.ClrType);
if (duplicateServiceProperty != null)
{
throw new InvalidOperationException(
CoreStrings.DuplicateServicePropertyType(
name,
serviceProperty.ClrType.ShortDisplayName(),
DisplayName(),
duplicateServiceProperty.Name,
duplicateServiceProperty.DeclaringEntityType.DisplayName()));
}
_serviceProperties[serviceProperty.Name] = serviceProperty;
return serviceProperty;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ServiceProperty? FindServiceProperty(string name)
=> FindDeclaredServiceProperty(Check.NotEmpty(name, nameof(name))) ?? _baseType?.FindServiceProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? FindServiceProperty(MemberInfo memberInfo)
=> FindProperty(memberInfo.GetSimpleMemberName());
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ServiceProperty? FindDeclaredServiceProperty(string name)
=> _serviceProperties.TryGetValue(Check.NotEmpty(name, nameof(name)), out var property)
? property
: null;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ServiceProperty> FindDerivedServiceProperties(string propertyName)
{
Check.NotNull(propertyName, nameof(propertyName));
return _directlyDerivedTypes.Count == 0
? Enumerable.Empty<ServiceProperty>()
: (IEnumerable<ServiceProperty>)GetDerivedTypes()
.Select(et => et.FindDeclaredServiceProperty(propertyName))
.Where(p => p != null);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ServiceProperty> FindDerivedServicePropertiesInclusive(string propertyName)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindDeclaredServiceProperty(propertyName))
: ToEnumerable(FindDeclaredServiceProperty(propertyName)).Concat(FindDerivedServiceProperties(propertyName));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ServiceProperty> FindServicePropertiesInHierarchy(string propertyName)
=> _directlyDerivedTypes.Count == 0
? ToEnumerable(FindServiceProperty(propertyName))
: ToEnumerable(FindServiceProperty(propertyName)).Concat(FindDerivedServiceProperties(propertyName));
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ServiceProperty? RemoveServiceProperty(string name)
{
Check.NotEmpty(name, nameof(name));
var property = FindServiceProperty(name);
return property == null
? null
: RemoveServiceProperty(property);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ServiceProperty RemoveServiceProperty(ServiceProperty property)
{
Check.NotNull(property, nameof(property));
Check.DebugAssert(IsInModel, "The entity type has been removed from the model");
EnsureMutable();
if (property.DeclaringEntityType != this)
{
throw new InvalidOperationException(
CoreStrings.PropertyWrongType(
property.Name,
DisplayName(),
property.DeclaringEntityType.DisplayName()));
}
var removed = _serviceProperties.Remove(property.Name);
Check.DebugAssert(removed, "removed is false");
property.SetRemovedFromModel();
return property;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ServiceProperty> GetServiceProperties()
=> _baseType != null
? _serviceProperties.Count == 0
? _baseType.GetServiceProperties()
: _baseType.GetServiceProperties().Concat(_serviceProperties.Values)
: _serviceProperties.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ServiceProperty> GetDeclaredServiceProperties()
=> _serviceProperties.Values;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<ServiceProperty> GetDerivedServiceProperties()
=> _directlyDerivedTypes.Count == 0
? Enumerable.Empty<ServiceProperty>()
: GetDerivedTypes().SelectMany(et => et.GetDeclaredServiceProperties());
#endregion
#region Ignore
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override ConfigurationSource? FindIgnoredConfigurationSource(string name)
{
var ignoredSource = FindDeclaredIgnoredConfigurationSource(name);
return BaseType == null ? ignoredSource : BaseType.FindIgnoredConfigurationSource(name).Max(ignoredSource);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override string? OnTypeMemberIgnored(string name)
=> Model.ConventionDispatcher.OnEntityTypeMemberIgnored(Builder, name);
#endregion
#region Data
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual IEnumerable<IDictionary<string, object?>> GetSeedData(bool providerValues = false)
{
if (_data == null
|| _data.Count == 0)
{
return Enumerable.Empty<IDictionary<string, object?>>();
}
var data = new List<Dictionary<string, object?>>();
var valueConverters = new Dictionary<string, ValueConverter?>(StringComparer.Ordinal);
var properties = GetProperties()
.Concat<IReadOnlyPropertyBase>(GetNavigations())
.Concat(GetSkipNavigations())
.ToDictionary(p => p.Name);
foreach (var rawSeed in _data)
{
var seed = new Dictionary<string, object?>(StringComparer.Ordinal);
data.Add(seed);
var type = rawSeed.GetType();
if (ClrType.IsAssignableFrom(type) == true)
{
// non-anonymous type
foreach (var propertyBase in properties.Values)
{
ValueConverter? valueConverter = null;
if (providerValues
&& propertyBase is IReadOnlyProperty property
&& !valueConverters.TryGetValue(propertyBase.Name, out valueConverter))
{
valueConverter = property.GetTypeMapping().Converter;
valueConverters[propertyBase.Name] = valueConverter;
}
object? value = null;
switch (propertyBase.GetIdentifyingMemberInfo())
{
case PropertyInfo propertyInfo:
if (propertyBase.IsIndexerProperty())
{
try
{
value = propertyInfo.GetValue(rawSeed, new[] { propertyBase.Name });
}
catch (Exception)
{
// Swallow if the property value is not set on the seed data
}
}
else
{
value = propertyInfo.GetValue(rawSeed);
}
break;
case FieldInfo fieldInfo:
value = fieldInfo.GetValue(rawSeed);
break;
case null:
continue;
}
seed[propertyBase.Name] = valueConverter == null
? value
: valueConverter.ConvertToProvider(value);
}
}
else
{
// anonymous type
foreach (var memberInfo in type.GetMembersInHierarchy())
{
if (!properties.TryGetValue(memberInfo.GetSimpleMemberName(), out var propertyBase))
{
continue;
}
ValueConverter? valueConverter = null;
if (providerValues
&& !valueConverters.TryGetValue(propertyBase.Name, out valueConverter))
{
if (propertyBase is IReadOnlyProperty property)
{
valueConverter = property.GetTypeMapping().Converter;
}
valueConverters[propertyBase.Name] = valueConverter;
}
// All memberInfos are PropertyInfo in anonymous type
var value = ((PropertyInfo)memberInfo).GetValue(rawSeed);
seed[propertyBase.Name] = valueConverter == null
? value
: valueConverter.ConvertToProvider(value);
}
}
}
return data;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual void AddData(IEnumerable<object> data)
{
EnsureMutable();
_data ??= new List<object>();
foreach (var entity in data)
{
if (ClrType != entity.GetType()
&& ClrType.IsAssignableFrom(entity.GetType()))
{
throw new InvalidOperationException(
CoreStrings.SeedDatumDerivedType(
DisplayName(), entity.GetType().ShortDisplayName()));
}
_data.Add(entity);
}
}
#endregion
#region Other
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
public virtual ChangeTrackingStrategy GetChangeTrackingStrategy()
=> _changeTrackingStrategy ?? Model.GetChangeTrackingStrategy();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ChangeTrackingStrategy? SetChangeTrackingStrategy(
ChangeTrackingStrategy? changeTrackingStrategy,
ConfigurationSource configurationSource)
{
EnsureMutable();
if (changeTrackingStrategy != null)
{
var requireFullNotifications = (string?)Model[CoreAnnotationNames.FullChangeTrackingNotificationsRequiredAnnotation] == "true";
var errorMessage = CheckChangeTrackingStrategy(this, changeTrackingStrategy.Value, requireFullNotifications);
if (errorMessage != null)
{
throw new InvalidOperationException(errorMessage);
}
}
_changeTrackingStrategy = changeTrackingStrategy;
_changeTrackingStrategyConfigurationSource = _changeTrackingStrategy == null
? (ConfigurationSource?)null
: configurationSource.Max(_changeTrackingStrategyConfigurationSource);
return changeTrackingStrategy;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public static string? CheckChangeTrackingStrategy(
IReadOnlyEntityType entityType, ChangeTrackingStrategy value, bool requireFullNotifications)
{
if (requireFullNotifications)
{
if (value != ChangeTrackingStrategy.ChangingAndChangedNotifications
&& value != ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues)
{
return CoreStrings.FullChangeTrackingRequired(
entityType.DisplayName(), value, nameof(ChangeTrackingStrategy.ChangingAndChangedNotifications),
nameof(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues));
}
}
else
{
if (value != ChangeTrackingStrategy.Snapshot
&& !typeof(INotifyPropertyChanged).IsAssignableFrom(entityType.ClrType))
{
return CoreStrings.ChangeTrackingInterfaceMissing(entityType.DisplayName(), value, nameof(INotifyPropertyChanged));
}
if ((value == ChangeTrackingStrategy.ChangingAndChangedNotifications
|| value == ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues)
&& !typeof(INotifyPropertyChanging).IsAssignableFrom(entityType.ClrType))
{
return CoreStrings.ChangeTrackingInterfaceMissing(entityType.DisplayName(), value, nameof(INotifyPropertyChanging));
}
}
return null;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ConfigurationSource? GetChangeTrackingStrategyConfigurationSource()
=> _changeTrackingStrategyConfigurationSource;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual LambdaExpression? SetQueryFilter(LambdaExpression? queryFilter, ConfigurationSource configurationSource)
{
var errorMessage = CheckQueryFilter(queryFilter);
if (errorMessage != null)
{
throw new InvalidOperationException(errorMessage);
}
return (LambdaExpression?)SetOrRemoveAnnotation(CoreAnnotationNames.QueryFilter, queryFilter, configurationSource)?.Value;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual string? CheckQueryFilter(LambdaExpression? queryFilter)
{
if (queryFilter != null
&& (queryFilter.Parameters.Count != 1
|| queryFilter.Parameters[0].Type != ClrType
|| queryFilter.ReturnType != typeof(bool)))
{
return CoreStrings.BadFilterExpression(queryFilter, DisplayName(), ClrType);
}
return null;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual LambdaExpression? GetQueryFilter() => (LambdaExpression?)this[CoreAnnotationNames.QueryFilter];
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ConfigurationSource? GetQueryFilterConfigurationSource()
=> FindAnnotation(CoreAnnotationNames.QueryFilter)?.GetConfigurationSource();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[Obsolete]
public virtual LambdaExpression? SetDefiningQuery(LambdaExpression? definingQuery, ConfigurationSource configurationSource)
=> (LambdaExpression?)SetOrRemoveAnnotation(CoreAnnotationNames.DefiningQuery, definingQuery, configurationSource)?.Value;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual Property? SetDiscriminatorProperty(Property? property, ConfigurationSource configurationSource)
{
CheckDiscriminatorProperty(property);
if (((property == null && BaseType == null)
|| (property != null && !property.ClrType.IsInstanceOfType(((IReadOnlyEntityType)this).GetDiscriminatorValue()))))
{
((IMutableEntityType)this).RemoveDiscriminatorValue();
if (BaseType == null)
{
foreach (var derivedType in GetDerivedTypes())
{
((IMutableEntityType)derivedType).RemoveDiscriminatorValue();
}
}
}
return ((string?)SetAnnotation(CoreAnnotationNames.DiscriminatorProperty, property?.Name, configurationSource)?.Value)
== property?.Name
? property
: (Property?)((IReadOnlyEntityType)this).FindDiscriminatorProperty();
}
private void CheckDiscriminatorProperty(Property? property)
{
if (property != null)
{
if (BaseType != null)
{
throw new InvalidOperationException(
CoreStrings.DiscriminatorPropertyMustBeOnRoot(DisplayName()));
}
if (property.DeclaringEntityType != this)
{
throw new InvalidOperationException(
CoreStrings.DiscriminatorPropertyNotFound(property.Name, DisplayName()));
}
}
}
/// <summary>
/// Returns the name of the property that will be used for storing a discriminator value.
/// </summary>
/// <returns> The name of the property that will be used for storing a discriminator value. </returns>
public virtual string? GetDiscriminatorPropertyName()
{
if (BaseType != null)
{
return ((IReadOnlyEntityType)this).GetRootType().GetDiscriminatorPropertyName();
}
return (string?)this[CoreAnnotationNames.DiscriminatorProperty];
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public static object? CheckDiscriminatorValue(IReadOnlyEntityType entityType, object? value)
{
if (value is null)
{
return value;
}
var discriminatorProperty = entityType.FindDiscriminatorProperty();
if (discriminatorProperty is null)
{
throw new InvalidOperationException(
CoreStrings.NoDiscriminatorForValue(entityType.DisplayName(), entityType.GetRootType().DisplayName()));
}
if (!discriminatorProperty.ClrType.IsAssignableFrom(value.GetType()))
{
throw new InvalidOperationException(
CoreStrings.DiscriminatorValueIncompatible(value, discriminatorProperty.Name, discriminatorProperty.ClrType));
}
return value;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
public virtual ConfigurationSource? GetDiscriminatorPropertyConfigurationSource()
=> FindAnnotation(CoreAnnotationNames.DiscriminatorProperty)?.GetConfigurationSource();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual bool IsImplicitlyCreatedJoinEntityType
=> GetConfigurationSource() == ConfigurationSource.Convention
&& ClrType == Model.DefaultPropertyBagType;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual InstantiationBinding? ConstructorBinding
{
get => IsReadOnly && !ClrType.IsAbstract
? NonCapturingLazyInitializer.EnsureInitialized(ref _constructorBinding, this, static entityType =>
{
((IModel)entityType.Model).GetModelDependencies().ConstructorBindingFactory.GetBindings(
(IReadOnlyEntityType)entityType,
out entityType._constructorBinding,
out entityType._serviceOnlyConstructorBinding);
})
: _constructorBinding;
set => SetConstructorBinding(value, ConfigurationSource.Explicit);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual InstantiationBinding? SetConstructorBinding(
InstantiationBinding? constructorBinding,
ConfigurationSource configurationSource)
{
EnsureMutable();
_constructorBinding = constructorBinding;
if (_constructorBinding == null)
{
_constructorBindingConfigurationSource = null;
}
else
{
UpdateConstructorBindingConfigurationSource(configurationSource);
}
return constructorBinding;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ConfigurationSource? GetConstructorBindingConfigurationSource()
=> _constructorBindingConfigurationSource;
private void UpdateConstructorBindingConfigurationSource(ConfigurationSource configurationSource)
=> _constructorBindingConfigurationSource = configurationSource.Max(_constructorBindingConfigurationSource);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual InstantiationBinding? ServiceOnlyConstructorBinding
{
get => _serviceOnlyConstructorBinding;
set => SetServiceOnlyConstructorBinding(value, ConfigurationSource.Explicit);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual InstantiationBinding? SetServiceOnlyConstructorBinding(
InstantiationBinding? constructorBinding,
ConfigurationSource configurationSource)
{
EnsureMutable();
_serviceOnlyConstructorBinding = constructorBinding;
if (_serviceOnlyConstructorBinding == null)
{
_serviceOnlyConstructorBindingConfigurationSource = null;
}
else
{
UpdateServiceOnlyConstructorBindingConfigurationSource(configurationSource);
}
return constructorBinding;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual ConfigurationSource? GetServiceOnlyConstructorBindingConfigurationSource()
=> _serviceOnlyConstructorBindingConfigurationSource;
private void UpdateServiceOnlyConstructorBindingConfigurationSource(ConfigurationSource configurationSource)
=> _serviceOnlyConstructorBindingConfigurationSource = configurationSource.Max(_serviceOnlyConstructorBindingConfigurationSource);
#endregion
#region Explicit interface implementations
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IConventionEntityTypeBuilder IConventionEntityType.Builder
{
[DebuggerStepThrough]
get => Builder;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IConventionAnnotatableBuilder IConventionAnnotatable.Builder
{
[DebuggerStepThrough]
get => Builder;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IReadOnlyModel IReadOnlyTypeBase.Model
{
[DebuggerStepThrough]
get => Model;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IMutableModel IMutableTypeBase.Model
{
[DebuggerStepThrough]
get => Model;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IMutableModel IMutableEntityType.Model
{
[DebuggerStepThrough]
get => Model;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IConventionModel IConventionEntityType.Model
{
[DebuggerStepThrough]
get => Model;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IModel ITypeBase.Model
{
[DebuggerStepThrough]
get => Model;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IReadOnlyEntityType? IReadOnlyEntityType.BaseType
{
[DebuggerStepThrough]
get => _baseType;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IMutableEntityType? IMutableEntityType.BaseType
{
get => _baseType;
set => SetBaseType((EntityType?)value, ConfigurationSource.Explicit);
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IConventionEntityType? IConventionEntityType.BaseType
{
[DebuggerStepThrough]
get => BaseType;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IEntityType? IEntityType.BaseType
{
[DebuggerStepThrough]
get => BaseType;
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
void IMutableEntityType.SetDiscriminatorProperty(IReadOnlyProperty? property)
=> SetDiscriminatorProperty((Property?)property, ConfigurationSource.Explicit);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionProperty? IConventionEntityType.SetDiscriminatorProperty(
IReadOnlyProperty? property, bool fromDataAnnotation)
=> SetDiscriminatorProperty((Property?)property,
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
void IMutableEntityType.SetChangeTrackingStrategy(ChangeTrackingStrategy? changeTrackingStrategy)
=> SetChangeTrackingStrategy(changeTrackingStrategy, ConfigurationSource.Explicit);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
ChangeTrackingStrategy? IConventionEntityType.SetChangeTrackingStrategy(
ChangeTrackingStrategy? changeTrackingStrategy,
bool fromDataAnnotation)
=> SetChangeTrackingStrategy(
changeTrackingStrategy, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
void IMutableEntityType.SetQueryFilter(LambdaExpression? queryFilter)
=> SetQueryFilter(queryFilter, ConfigurationSource.Explicit);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
LambdaExpression? IConventionEntityType.SetQueryFilter(LambdaExpression? queryFilter, bool fromDataAnnotation)
=> SetQueryFilter(queryFilter, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyEntityType> IReadOnlyEntityType.GetDerivedTypes()
=> GetDerivedTypes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyEntityType> IReadOnlyEntityType.GetDirectlyDerivedTypes()
=> GetDirectlyDerivedTypes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IEntityType> IEntityType.GetDirectlyDerivedTypes()
=> GetDirectlyDerivedTypes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
IConventionEntityType? IConventionEntityType.SetBaseType(IConventionEntityType? entityType, bool fromDataAnnotation)
=> SetBaseType(
(EntityType?)entityType, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
bool? IConventionEntityType.SetIsKeyless(bool? keyless, bool fromDataAnnotation)
=> SetIsKeyless(keyless, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableKey? IMutableEntityType.SetPrimaryKey(IReadOnlyList<IMutableProperty>? properties)
=> SetPrimaryKey(properties?.Cast<Property>().ToList(), ConfigurationSource.Explicit);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionKey? IConventionEntityType.SetPrimaryKey(IReadOnlyList<IConventionProperty>? properties, bool fromDataAnnotation)
=> SetPrimaryKey(
properties?.Cast<Property>().ToList(),
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyKey? IReadOnlyEntityType.FindPrimaryKey()
=> FindPrimaryKey();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableKey? IMutableEntityType.FindPrimaryKey()
=> FindPrimaryKey();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionKey? IConventionEntityType.FindPrimaryKey()
=> FindPrimaryKey();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IKey? IEntityType.FindPrimaryKey()
=> FindPrimaryKey();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableKey IMutableEntityType.AddKey(IReadOnlyList<IMutableProperty> properties)
=> AddKey(properties.Cast<Property>().ToList(), ConfigurationSource.Explicit)!;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionKey? IConventionEntityType.AddKey(IReadOnlyList<IConventionProperty> properties, bool fromDataAnnotation)
=> AddKey(
properties.Cast<Property>().ToList(),
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyKey? IReadOnlyEntityType.FindKey(IReadOnlyList<IReadOnlyProperty> properties)
=> FindKey(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableKey? IMutableEntityType.FindKey(IReadOnlyList<IReadOnlyProperty> properties)
=> FindKey(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionKey? IConventionEntityType.FindKey(IReadOnlyList<IReadOnlyProperty> properties)
=> FindKey(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IKey? IEntityType.FindKey(IReadOnlyList<IReadOnlyProperty> properties)
=> FindKey(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyKey> IReadOnlyEntityType.GetDeclaredKeys()
=> GetDeclaredKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IKey> IEntityType.GetDeclaredKeys()
=> GetDeclaredKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyKey> IReadOnlyEntityType.GetKeys()
=> GetKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IMutableKey> IMutableEntityType.GetKeys()
=> GetKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IConventionKey> IConventionEntityType.GetKeys()
=> GetKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IKey> IEntityType.GetKeys()
=> GetKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableKey? IMutableEntityType.RemoveKey(IReadOnlyList<IReadOnlyProperty> properties)
=> RemoveKey(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionKey? IConventionEntityType.RemoveKey(IReadOnlyList<IReadOnlyProperty> properties)
=> RemoveKey(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableKey? IMutableEntityType.RemoveKey(IReadOnlyKey key)
=> RemoveKey((Key)key);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionKey? IConventionEntityType.RemoveKey(IReadOnlyKey key)
=> RemoveKey((Key)key);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableForeignKey IMutableEntityType.AddForeignKey(
IReadOnlyList<IMutableProperty> properties,
IMutableKey principalKey,
IMutableEntityType principalEntityType)
=> AddForeignKey(
properties.Cast<Property>().ToList(),
(Key)principalKey,
(EntityType)principalEntityType,
ConfigurationSource.Explicit,
ConfigurationSource.Explicit)!;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionForeignKey? IConventionEntityType.AddForeignKey(
IReadOnlyList<IConventionProperty> properties,
IConventionKey principalKey,
IConventionEntityType principalEntityType,
bool setComponentConfigurationSource,
bool fromDataAnnotation)
=> AddForeignKey(
properties.Cast<Property>().ToList(),
(Key)principalKey,
(EntityType)principalEntityType,
setComponentConfigurationSource
? fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention
: (ConfigurationSource?)null,
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyForeignKey? IReadOnlyEntityType.FindForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
=> FindForeignKey(properties, principalKey, principalEntityType);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableForeignKey? IMutableEntityType.FindForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
=> FindForeignKey(properties, principalKey, principalEntityType);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionForeignKey? IConventionEntityType.FindForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
=> FindForeignKey(properties, principalKey, principalEntityType);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IForeignKey? IEntityType.FindForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IReadOnlyKey principalKey,
IReadOnlyEntityType principalEntityType)
=> FindForeignKey(properties, principalKey, principalEntityType);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyForeignKey> IReadOnlyEntityType.FindForeignKeys(IReadOnlyList<IReadOnlyProperty> properties)
=> FindForeignKeys(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IForeignKey> IEntityType.FindForeignKeys(IReadOnlyList<IReadOnlyProperty> properties)
=> FindForeignKeys(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyForeignKey> IReadOnlyEntityType.FindDeclaredForeignKeys(IReadOnlyList<IReadOnlyProperty> properties)
=> FindDeclaredForeignKeys(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IForeignKey> IEntityType.FindDeclaredForeignKeys(IReadOnlyList<IReadOnlyProperty> properties)
=> FindDeclaredForeignKeys(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyForeignKey> IReadOnlyEntityType.GetForeignKeys()
=> GetForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IMutableForeignKey> IMutableEntityType.GetForeignKeys()
=> GetForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IConventionForeignKey> IConventionEntityType.GetForeignKeys()
=> GetForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IForeignKey> IEntityType.GetForeignKeys()
=> GetForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyForeignKey> IReadOnlyEntityType.GetDeclaredForeignKeys()
=> GetDeclaredForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IForeignKey> IEntityType.GetDeclaredForeignKeys()
=> GetDeclaredForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyForeignKey> IReadOnlyEntityType.GetDerivedForeignKeys()
=> GetDerivedForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IForeignKey> IEntityType.GetDerivedForeignKeys()
=> GetDerivedForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyForeignKey> IReadOnlyEntityType.GetDeclaredReferencingForeignKeys()
=> GetDeclaredReferencingForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IForeignKey> IEntityType.GetDeclaredReferencingForeignKeys()
=> GetDeclaredReferencingForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyForeignKey> IReadOnlyEntityType.GetReferencingForeignKeys()
=> GetReferencingForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IForeignKey> IEntityType.GetReferencingForeignKeys()
=> GetReferencingForeignKeys();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionForeignKey? IConventionEntityType.RemoveForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IConventionKey principalKey,
IConventionEntityType principalEntityType)
=> RemoveForeignKey(properties, principalKey, principalEntityType);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableForeignKey? IMutableEntityType.RemoveForeignKey(
IReadOnlyList<IReadOnlyProperty> properties,
IMutableKey principalKey,
IMutableEntityType principalEntityType)
=> RemoveForeignKey(properties, principalKey, principalEntityType);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableForeignKey? IMutableEntityType.RemoveForeignKey(IReadOnlyForeignKey foreignKey)
=> RemoveForeignKey((ForeignKey)foreignKey);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionForeignKey? IConventionEntityType.RemoveForeignKey(IReadOnlyForeignKey foreignKey)
=> RemoveForeignKey((ForeignKey)foreignKey);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyNavigation> IReadOnlyEntityType.GetDeclaredNavigations()
=> GetDeclaredNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<INavigation> IEntityType.GetDeclaredNavigations()
=> GetDeclaredNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyNavigation? IReadOnlyEntityType.FindDeclaredNavigation(string name)
=> FindDeclaredNavigation(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
INavigation? IEntityType.FindDeclaredNavigation(string name)
=> FindDeclaredNavigation(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyNavigation> IReadOnlyEntityType.GetDerivedNavigations()
=> GetDerivedNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyNavigation> IReadOnlyEntityType.GetNavigations()
=> GetNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<INavigation> IEntityType.GetNavigations()
=> GetNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableSkipNavigation IMutableEntityType.AddSkipNavigation(
string name,
MemberInfo? memberInfo,
IMutableEntityType targetEntityType,
bool collection,
bool onDependent)
=> AddSkipNavigation(
name, memberInfo, (EntityType)targetEntityType, collection, onDependent,
ConfigurationSource.Explicit)!;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionSkipNavigation? IConventionEntityType.AddSkipNavigation(
string name,
MemberInfo? memberInfo,
IConventionEntityType targetEntityType,
bool collection,
bool onDependent,
bool fromDataAnnotation)
=> AddSkipNavigation(
name, memberInfo, (EntityType)targetEntityType, collection, onDependent,
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlySkipNavigation? IReadOnlyEntityType.FindSkipNavigation(MemberInfo memberInfo)
=> FindSkipNavigation(memberInfo);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlySkipNavigation? IReadOnlyEntityType.FindSkipNavigation(string name)
=> FindSkipNavigation(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableSkipNavigation? IMutableEntityType.FindSkipNavigation(string name)
=> FindSkipNavigation(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionSkipNavigation? IConventionEntityType.FindSkipNavigation(string name)
=> FindSkipNavigation(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
ISkipNavigation? IEntityType.FindSkipNavigation(string name)
=> FindSkipNavigation(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlySkipNavigation? IReadOnlyEntityType.FindDeclaredSkipNavigation(string name)
=> FindDeclaredSkipNavigation(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlySkipNavigation> IReadOnlyEntityType.GetDeclaredSkipNavigations()
=> GetDeclaredSkipNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlySkipNavigation> IReadOnlyEntityType.GetDerivedSkipNavigations()
=> GetDerivedSkipNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlySkipNavigation> IReadOnlyEntityType.GetSkipNavigations()
=> GetSkipNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IMutableSkipNavigation> IMutableEntityType.GetSkipNavigations()
=> GetSkipNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IConventionSkipNavigation> IConventionEntityType.GetSkipNavigations()
=> GetSkipNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<ISkipNavigation> IEntityType.GetSkipNavigations()
=> GetSkipNavigations();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableSkipNavigation? IMutableEntityType.RemoveSkipNavigation(IReadOnlySkipNavigation navigation)
=> RemoveSkipNavigation((SkipNavigation)navigation);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionSkipNavigation? IConventionEntityType.RemoveSkipNavigation(IReadOnlySkipNavigation navigation)
=> RemoveSkipNavigation((SkipNavigation)navigation);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableIndex IMutableEntityType.AddIndex(IReadOnlyList<IMutableProperty> properties)
=> AddIndex(properties as IReadOnlyList<Property> ?? properties.Cast<Property>().ToList(), ConfigurationSource.Explicit)!;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableIndex IMutableEntityType.AddIndex(IReadOnlyList<IMutableProperty> properties, string name)
=> AddIndex(properties as IReadOnlyList<Property> ?? properties.Cast<Property>().ToList(), name, ConfigurationSource.Explicit)!;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionIndex? IConventionEntityType.AddIndex(IReadOnlyList<IConventionProperty> properties, bool fromDataAnnotation)
=> AddIndex(
properties as IReadOnlyList<Property> ?? properties.Cast<Property>().ToList(),
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionIndex? IConventionEntityType.AddIndex(
IReadOnlyList<IConventionProperty> properties,
string name,
bool fromDataAnnotation)
=> AddIndex(
properties as IReadOnlyList<Property> ?? properties.Cast<Property>().ToList(),
name,
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyIndex? IReadOnlyEntityType.FindIndex(IReadOnlyList<IReadOnlyProperty> properties)
=> FindIndex(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableIndex? IMutableEntityType.FindIndex(IReadOnlyList<IReadOnlyProperty> properties)
=> FindIndex(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionIndex? IConventionEntityType.FindIndex(IReadOnlyList<IReadOnlyProperty> properties)
=> FindIndex(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IIndex? IEntityType.FindIndex(IReadOnlyList<IReadOnlyProperty> properties)
=> FindIndex(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyIndex? IReadOnlyEntityType.FindIndex(string name)
=> FindIndex(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableIndex? IMutableEntityType.FindIndex(string name)
=> FindIndex(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionIndex? IConventionEntityType.FindIndex(string name)
=> FindIndex(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IIndex? IEntityType.FindIndex(string name)
=> FindIndex(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyIndex> IReadOnlyEntityType.GetDeclaredIndexes()
=> GetDeclaredIndexes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IIndex> IEntityType.GetDeclaredIndexes()
=> GetDeclaredIndexes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyIndex> IReadOnlyEntityType.GetDerivedIndexes()
=> GetDerivedIndexes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IIndex> IEntityType.GetDerivedIndexes()
=> GetDerivedIndexes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyIndex> IReadOnlyEntityType.GetIndexes()
=> GetIndexes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IMutableIndex> IMutableEntityType.GetIndexes()
=> GetIndexes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IConventionIndex> IConventionEntityType.GetIndexes()
=> GetIndexes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IIndex> IEntityType.GetIndexes()
=> GetIndexes();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionIndex? IConventionEntityType.RemoveIndex(IReadOnlyList<IReadOnlyProperty> properties)
=> RemoveIndex(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableIndex? IMutableEntityType.RemoveIndex(IReadOnlyList<IReadOnlyProperty> properties)
=> RemoveIndex(properties);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableIndex? IMutableEntityType.RemoveIndex(IReadOnlyIndex index)
=> RemoveIndex((Index)index);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionIndex? IConventionEntityType.RemoveIndex(IReadOnlyIndex index)
=> RemoveIndex((Index)index);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableProperty IMutableEntityType.AddProperty(string name)
=> AddProperty(name, ConfigurationSource.Explicit)!;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionProperty? IConventionEntityType.AddProperty(string name, bool fromDataAnnotation)
=> AddProperty(
name,
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableProperty IMutableEntityType.AddProperty(string name, Type propertyType)
=> AddProperty(
name,
propertyType,
ConfigurationSource.Explicit,
ConfigurationSource.Explicit)!;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionProperty? IConventionEntityType.AddProperty(
string name,
Type propertyType,
bool setTypeConfigurationSource,
bool fromDataAnnotation)
=> AddProperty(
name,
propertyType,
setTypeConfigurationSource
? fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention
: (ConfigurationSource?)null,
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableProperty IMutableEntityType.AddProperty(string name, Type propertyType, MemberInfo? memberInfo)
=> AddProperty(
name, propertyType, memberInfo ?? ClrType.GetMembersInHierarchy(name).FirstOrDefault(),
ConfigurationSource.Explicit, ConfigurationSource.Explicit)!;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionProperty? IConventionEntityType.AddProperty(
string name,
Type propertyType,
MemberInfo? memberInfo,
bool setTypeConfigurationSource,
bool fromDataAnnotation)
=> AddProperty(
name,
propertyType,
memberInfo ?? ClrType.GetMembersInHierarchy(name).FirstOrDefault(),
setTypeConfigurationSource
? fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention
: (ConfigurationSource?)null,
fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyProperty? IReadOnlyEntityType.FindDeclaredProperty(string name)
=> FindDeclaredProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IProperty? IEntityType.FindDeclaredProperty(string name)
=> FindDeclaredProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyList<IReadOnlyProperty>? IReadOnlyEntityType.FindProperties(IReadOnlyList<string> propertyNames)
=> FindProperties(propertyNames);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyProperty? IReadOnlyEntityType.FindProperty(string name)
=> FindProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableProperty? IMutableEntityType.FindProperty(string name)
=> FindProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionProperty? IConventionEntityType.FindProperty(string name)
=> FindProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IProperty? IEntityType.FindProperty(string name)
=> FindProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyProperty> IReadOnlyEntityType.GetDeclaredProperties()
=> GetDeclaredProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IProperty> IEntityType.GetDeclaredProperties()
=> GetDeclaredProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyProperty> IReadOnlyEntityType.GetDerivedProperties()
=> GetDerivedProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyProperty> IReadOnlyEntityType.GetProperties()
=> GetProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IMutableProperty> IMutableEntityType.GetProperties()
=> GetProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IConventionProperty> IConventionEntityType.GetProperties()
=> GetProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IProperty> IEntityType.GetProperties()
=> GetProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IProperty> IEntityType.GetForeignKeyProperties()
=> ForeignKeyProperties;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IProperty> IEntityType.GetValueGeneratingProperties()
=> ValueGeneratingProperties;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableProperty? IMutableEntityType.RemoveProperty(string name)
=> RemoveProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionProperty? IConventionEntityType.RemoveProperty(string name)
=> RemoveProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableProperty? IMutableEntityType.RemoveProperty(IReadOnlyProperty property)
=> RemoveProperty((Property)property);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionProperty? IConventionEntityType.RemoveProperty(IReadOnlyProperty property)
=> RemoveProperty((Property)property);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableServiceProperty IMutableEntityType.AddServiceProperty(MemberInfo memberInfo)
=> AddServiceProperty(memberInfo, ConfigurationSource.Explicit);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionServiceProperty IConventionEntityType.AddServiceProperty(MemberInfo memberInfo, bool fromDataAnnotation)
=> AddServiceProperty(memberInfo, fromDataAnnotation ? ConfigurationSource.DataAnnotation : ConfigurationSource.Convention);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IReadOnlyServiceProperty? IReadOnlyEntityType.FindServiceProperty(string name)
=> FindServiceProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableServiceProperty? IMutableEntityType.FindServiceProperty(string name)
=> FindServiceProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionServiceProperty? IConventionEntityType.FindServiceProperty(string name)
=> FindServiceProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IServiceProperty? IEntityType.FindServiceProperty(string name)
=> FindServiceProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyServiceProperty> IReadOnlyEntityType.GetDeclaredServiceProperties()
=> GetDeclaredServiceProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IServiceProperty> IEntityType.GetDeclaredServiceProperties()
=> GetDeclaredServiceProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyServiceProperty> IReadOnlyEntityType.GetDerivedServiceProperties()
=> GetDerivedServiceProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IReadOnlyServiceProperty> IReadOnlyEntityType.GetServiceProperties()
=> GetServiceProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IMutableServiceProperty> IMutableEntityType.GetServiceProperties()
=> GetServiceProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IConventionServiceProperty> IConventionEntityType.GetServiceProperties()
=> GetServiceProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IEnumerable<IServiceProperty> IEntityType.GetServiceProperties()
=> GetServiceProperties();
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableServiceProperty? IMutableEntityType.RemoveServiceProperty(IReadOnlyServiceProperty property)
=> RemoveServiceProperty((ServiceProperty)property);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionServiceProperty? IConventionEntityType.RemoveServiceProperty(IReadOnlyServiceProperty property)
=> RemoveServiceProperty((ServiceProperty)property);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IMutableServiceProperty? IMutableEntityType.RemoveServiceProperty(string name)
=> RemoveServiceProperty(name);
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[DebuggerStepThrough]
IConventionServiceProperty? IConventionEntityType.RemoveServiceProperty(string name)
=> RemoveServiceProperty(name);
#endregion
private static IEnumerable<T> ToEnumerable<T>(T? element)
where T : class
=> element == null
? Enumerable.Empty<T>()
: new[] { element };
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public class Snapshot
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public Snapshot(
EntityType entityType,
PropertiesSnapshot? properties,
List<InternalIndexBuilder>? indexes,
List<(InternalKeyBuilder, ConfigurationSource?)>? keys,
List<RelationshipSnapshot>? relationships,
List<InternalSkipNavigationBuilder>? skipNavigations,
List<InternalServicePropertyBuilder>? serviceProperties)
{
EntityType = entityType;
Properties = properties ?? new PropertiesSnapshot(null, null, null, null);
if (indexes != null)
{
Properties.Add(indexes);
}
if (keys != null)
{
Properties.Add(keys);
}
if (relationships != null)
{
Properties.Add(relationships);
}
SkipNavigations = skipNavigations;
ServiceProperties = serviceProperties;
}
private EntityType EntityType { [DebuggerStepThrough] get; }
private PropertiesSnapshot Properties { [DebuggerStepThrough] get; }
private List<InternalSkipNavigationBuilder>? SkipNavigations { [DebuggerStepThrough] get; }
private List<InternalServicePropertyBuilder>? ServiceProperties { [DebuggerStepThrough] get; }
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual void Attach(InternalEntityTypeBuilder entityTypeBuilder)
{
entityTypeBuilder.MergeAnnotationsFrom(EntityType);
foreach (var ignoredMember in EntityType.GetIgnoredMembers())
{
entityTypeBuilder.Ignore(ignoredMember, EntityType.FindDeclaredIgnoredConfigurationSource(ignoredMember)!.Value);
}
if (ServiceProperties != null)
{
foreach (var detachedServiceProperty in ServiceProperties)
{
detachedServiceProperty.Attach(detachedServiceProperty.Metadata.DeclaringEntityType.Builder);
}
}
Properties.Attach(entityTypeBuilder);
if (SkipNavigations != null)
{
foreach (var detachedSkipNavigation in SkipNavigations)
{
detachedSkipNavigation.Attach();
}
}
var rawData = EntityType._data;
if (rawData != null)
{
entityTypeBuilder.Metadata.AddData(rawData);
}
}
}
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public virtual DebugView DebugView
=> new(
() => ((IReadOnlyEntityType)this).ToDebugString(MetadataDebugStringOptions.ShortDefault),
() => ((IReadOnlyEntityType)this).ToDebugString(MetadataDebugStringOptions.LongDefault));
}
}
| 56.274403 | 147 | 0.642049 | [
"Apache-2.0"
] | carlreid/efcore | src/EFCore/Metadata/Internal/EntityType.cs | 299,211 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Windows.Forms
{
using System.Diagnostics;
using System;
/// <summary>
/// <para>
/// Specifies the return value for HITTEST on treeview.
/// </para>
/// </summary>
public class TreeViewHitTestInfo
{
private readonly TreeViewHitTestLocations loc;
private readonly TreeNode node;
/// <summary>
/// Creates a TreeViewHitTestInfo instance.
/// </summary>
public TreeViewHitTestInfo(TreeNode hitNode, TreeViewHitTestLocations hitLocation)
{
node = hitNode;
loc = hitLocation;
}
/// <summary>
/// This gives the exact location returned by hit test on treeview.
/// </summary>
public TreeViewHitTestLocations Location
{
get
{
return loc;
}
}
/// <summary>
/// This gives the node returned by hit test on treeview.
/// </summary>
public TreeNode Node
{
get
{
return node;
}
}
}
}
| 24.6 | 90 | 0.541759 | [
"MIT"
] | Bhaskers-Blu-Org2/winforms | src/System.Windows.Forms/src/System/Windows/Forms/TreeViewHitTestInfo.cs | 1,355 | C# |
using System;
using System.Threading.Tasks;
using CompaniesHouse.Response.Officers;
using NUnit.Framework;
namespace CompaniesHouse.IntegrationTests.Tests.OfficerTests
{
public abstract class OfficersTestBase
{
protected CompaniesHouseClient _client;
protected CompaniesHouseClientResponse<Officers> _result;
[SetUp]
public void Setup()
{
GivenACompaniesHouseClient();
When();
}
protected abstract Task When();
private void GivenACompaniesHouseClient()
{
var settings = new CompaniesHouseSettings(Keys.ApiKey);
_client = new CompaniesHouseClient(settings);
}
}
}
| 24.413793 | 67 | 0.65678 | [
"MIT"
] | SreejithNair/CompaniesHouse.NET | src/CompaniesHouse.IntegrationTests/Tests/OfficerTests/OfficersTestBase.cs | 710 | C# |
using Copa.Domain.Copa.FasesCopa;
using Copa.Domain.Copa.Partidas;
using Copa.Domain.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Copa.Domain.Copa.DefinicaoPartidas
{
[RegraFaseCopa(EnumFaseCopa.Final)]
public class RegraDefinicaoPartidaFinal : IRegraDefinicaoPartida
{
public List<Partida> DefinaPartidasDaFase(List<Equipe> equipes) => new List<Partida>{new Partida(equipes.First(), equipes.Last())};
}
}
| 27.888889 | 139 | 0.752988 | [
"MIT"
] | JDouglasMendes/Copa | desafio-a-copa-server/Copa/Copa.Domain/Copa/DefinicaoPartidas/RegraDefinicaoPartidaFinal.cs | 504 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using System.Threading;
using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Represents an immutable snapshot of assembly CLI metadata.
/// </summary>
public sealed class AssemblyMetadata : Metadata
{
private sealed class Data
{
public static readonly Data Disposed = new Data();
public readonly ImmutableArray<ModuleMetadata> Modules;
public readonly PEAssembly Assembly;
private Data()
{
}
public Data(ImmutableArray<ModuleMetadata> modules, PEAssembly assembly)
{
Debug.Assert(!modules.IsDefaultOrEmpty && assembly != null);
this.Modules = modules;
this.Assembly = assembly;
}
public bool IsDisposed
{
get { return Assembly == null; }
}
}
/// <summary>
/// Factory that provides the <see cref="ModuleMetadata"/> for additional modules (other than <see cref="_initialModules"/>) of the assembly.
/// Shall only throw <see cref="BadImageFormatException"/> or <see cref="IOException"/>.
/// Null of all modules were specified at construction time.
/// </summary>
private readonly Func<string, ModuleMetadata> _moduleFactoryOpt;
/// <summary>
/// Modules the <see cref="AssemblyMetadata"/> was created with, in case they are eagerly allocated.
/// </summary>
private readonly ImmutableArray<ModuleMetadata> _initialModules;
// Encapsulates the modules and the corresponding PEAssembly produced by the modules factory.
private Data _lazyData;
// The actual array of modules exposed via Modules property.
// The same modules as the ones produced by the factory or their copies.
private ImmutableArray<ModuleMetadata> _lazyPublishedModules;
/// <summary>
/// Cached assembly symbols.
/// </summary>
/// <remarks>
/// Guarded by <see cref="CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard"/>.
/// </remarks>
internal readonly WeakList<IAssemblySymbol> CachedSymbols = new WeakList<IAssemblySymbol>();
// creates a copy
private AssemblyMetadata(AssemblyMetadata other)
: base(isImageOwner: false, id: other.Id)
{
this.CachedSymbols = other.CachedSymbols;
_lazyData = other._lazyData;
_moduleFactoryOpt = other._moduleFactoryOpt;
_initialModules = other._initialModules;
// Leave lazyPublishedModules unset. Published modules will be set and copied as needed.
}
internal AssemblyMetadata(ImmutableArray<ModuleMetadata> modules)
: base(isImageOwner: true, id: MetadataId.CreateNewId())
{
Debug.Assert(!modules.IsDefaultOrEmpty);
_initialModules = modules;
}
internal AssemblyMetadata(ModuleMetadata manifestModule, Func<string, ModuleMetadata> moduleFactory)
: base(isImageOwner: true, id: MetadataId.CreateNewId())
{
Debug.Assert(manifestModule != null);
Debug.Assert(moduleFactory != null);
_initialModules = ImmutableArray.Create(manifestModule);
_moduleFactoryOpt = moduleFactory;
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peImage">
/// Manifest module image.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="peImage"/> is null.</exception>
public static AssemblyMetadata CreateFromImage(ImmutableArray<byte> peImage)
{
return Create(ModuleMetadata.CreateFromImage(peImage));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peImage">
/// Manifest module image.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="peImage"/> is null.</exception>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromImage(IEnumerable<byte> peImage)
{
return Create(ModuleMetadata.CreateFromImage(peImage));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peStream">Manifest module PE image stream.</param>
/// <param name="leaveOpen">False to close the stream upon disposal of the metadata.</param>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromStream(Stream peStream, bool leaveOpen = false)
{
return Create(ModuleMetadata.CreateFromStream(peStream, leaveOpen));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peStream">Manifest module PE image stream.</param>
/// <param name="options">False to close the stream upon disposal of the metadata.</param>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromStream(Stream peStream, PEStreamOptions options)
{
return Create(ModuleMetadata.CreateFromStream(peStream, options));
}
/// <summary>
/// Finds all modules of an assembly on a specified path and builds an instance of <see cref="AssemblyMetadata"/> that represents them.
/// </summary>
/// <param name="path">The full path to the assembly on disk.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is invalid.</exception>
/// <exception cref="IOException">Error reading file <paramref name="path"/>. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="NotSupportedException">Reading from a file path is not supported by the platform.</exception>
public static AssemblyMetadata CreateFromFile(string path)
{
return CreateFromFile(ModuleMetadata.CreateFromFile(path), path);
}
internal static AssemblyMetadata CreateFromFile(ModuleMetadata manifestModule, string path)
{
return new AssemblyMetadata(manifestModule, moduleName => ModuleMetadata.CreateFromFile(Path.Combine(Path.GetDirectoryName(path), moduleName)));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="module">
/// Manifest module.
/// </param>
/// <remarks>This object disposes <paramref name="module"/> it when it is itself disposed.</remarks>
public static AssemblyMetadata Create(ModuleMetadata module)
{
if (module == null)
{
throw new ArgumentNullException(nameof(module));
}
return new AssemblyMetadata(ImmutableArray.Create(module));
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">
/// Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(ImmutableArray<ModuleMetadata> modules)
{
if (modules.IsDefaultOrEmpty)
{
throw new ArgumentException(CodeAnalysisResources.AssemblyMustHaveAtLeastOneModule, nameof(modules));
}
for (int i = 0; i < modules.Length; i++)
{
if (modules[i] == null)
{
throw new ArgumentNullException(nameof(modules) + "[" + i + "]");
}
if (!modules[i].IsImageOwner)
{
throw new ArgumentException(CodeAnalysisResources.ModuleCopyCannotBeUsedToCreateAssemblyMetadata, nameof(modules) + "[" + i + "]");
}
}
return new AssemblyMetadata(modules);
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">
/// Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(IEnumerable<ModuleMetadata> modules)
{
return Create(modules.AsImmutableOrNull());
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(params ModuleMetadata[] modules)
{
return Create(ImmutableArray.CreateRange(modules));
}
/// <summary>
/// Creates a shallow copy of contained modules and wraps them into a new instance of <see cref="AssemblyMetadata"/>.
/// </summary>
/// <remarks>
/// The resulting copy shares the metadata images and metadata information read from them with the original.
/// It doesn't own the underlying metadata images and is not responsible for its disposal.
///
/// This is used, for example, when a metadata cache needs to return the cached metadata to its users
/// while keeping the ownership of the cached metadata object.
/// </remarks>
internal new AssemblyMetadata Copy()
{
return new AssemblyMetadata(this);
}
protected override Metadata CommonCopy()
{
return Copy();
}
/// <summary>
/// Modules comprising this assembly. The first module is the manifest module.
/// </summary>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
public ImmutableArray<ModuleMetadata> GetModules()
{
if (_lazyPublishedModules.IsDefault)
{
Data data = GetOrCreateData();
ImmutableArray<ModuleMetadata> newModules = data.Modules;
if (!IsImageOwner)
{
newModules = newModules.SelectAsArray(module => module.Copy());
}
ImmutableInterlocked.InterlockedInitialize(ref _lazyPublishedModules, newModules);
}
if (_lazyData == Data.Disposed)
{
throw new ObjectDisposedException(nameof(AssemblyMetadata));
}
return _lazyPublishedModules;
}
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error while reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
internal PEAssembly GetAssembly()
{
return GetOrCreateData().Assembly;
}
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error while reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
private Data GetOrCreateData()
{
if (_lazyData == null)
{
ImmutableArray<ModuleMetadata> modules = _initialModules;
ImmutableArray<ModuleMetadata>.Builder moduleBuilder = null;
bool createdModulesUsed = false;
try
{
if (_moduleFactoryOpt != null)
{
Debug.Assert(_initialModules.Length == 1);
ImmutableArray<string> additionalModuleNames = _initialModules[0].GetModuleNames();
if (additionalModuleNames.Length > 0)
{
moduleBuilder = ImmutableArray.CreateBuilder<ModuleMetadata>(1 + additionalModuleNames.Length);
moduleBuilder.Add(_initialModules[0]);
foreach (string moduleName in additionalModuleNames)
{
moduleBuilder.Add(_moduleFactoryOpt(moduleName));
}
modules = moduleBuilder.ToImmutable();
}
}
PEAssembly assembly = new PEAssembly(this, modules.SelectAsArray(m => m.Module));
Data newData = new Data(modules, assembly);
createdModulesUsed = Interlocked.CompareExchange(ref _lazyData, newData, null) == null;
}
finally
{
if (moduleBuilder != null && !createdModulesUsed)
{
// dispose unused modules created above:
for (int i = _initialModules.Length; i < moduleBuilder.Count; i++)
{
moduleBuilder[i].Dispose();
}
}
}
}
if (_lazyData.IsDisposed)
{
throw new ObjectDisposedException(nameof(AssemblyMetadata));
}
return _lazyData;
}
/// <summary>
/// Disposes all modules contained in the assembly.
/// </summary>
public override void Dispose()
{
Data previousData = Interlocked.Exchange(ref _lazyData, Data.Disposed);
if (previousData == Data.Disposed || !this.IsImageOwner)
{
// already disposed, or not an owner
return;
}
// AssemblyMetadata assumes their ownership of all modules passed to the constructor.
foreach (ModuleMetadata module in _initialModules)
{
module.Dispose();
}
if (previousData == null)
{
// no additional modules were created yet => nothing to dispose
return;
}
Debug.Assert(_initialModules.Length == 1 || _initialModules.Length == previousData.Modules.Length);
// dispose additional modules created lazily:
for (int i = _initialModules.Length; i < previousData.Modules.Length; i++)
{
previousData.Modules[i].Dispose();
}
}
/// <summary>
/// Checks if the first module has a single row in Assembly table and that all other modules have none.
/// </summary>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
internal bool IsValidAssembly()
{
ImmutableArray<ModuleMetadata> modules = GetModules();
if (!modules[0].Module.IsManifestModule)
{
return false;
}
for (int i = 1; i < modules.Length; i++)
{
// Ignore winmd modules since runtime winmd modules may be loaded as non-primary modules.
PEModule module = modules[i].Module;
if (!module.IsLinkedModule && module.MetadataReader.MetadataKind != MetadataKind.WindowsMetadata)
{
return false;
}
}
return true;
}
/// <summary>
/// Returns the metadata kind. <seealso cref="MetadataImageKind"/>
/// </summary>
public override MetadataImageKind Kind
{
get { return MetadataImageKind.Assembly; }
}
/// <summary>
/// Creates a reference to the assembly metadata.
/// </summary>
/// <param name="documentation">Provider of XML documentation comments for the metadata symbols contained in the module.</param>
/// <param name="aliases">Aliases that can be used to refer to the assembly from source code (see "extern alias" directive in C#).</param>
/// <param name="embedInteropTypes">True to embed interop types from the referenced assembly to the referencing compilation. Must be false for a module.</param>
/// <param name="filePath">Path describing the location of the metadata, or null if the metadata have no location.</param>
/// <param name="display">Display string used in error messages to identity the reference.</param>
/// <returns>A reference to the assembly metadata.</returns>
public PortableExecutableReference GetReference(
DocumentationProvider documentation = null,
ImmutableArray<string> aliases = default(ImmutableArray<string>),
bool embedInteropTypes = false,
string filePath = null,
string display = null)
{
return new MetadataImageReference(this, new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases, embedInteropTypes), documentation, filePath, display);
}
}
}
| 45.002242 | 190 | 0.604952 | [
"MIT"
] | Ollon/MSBuildTemplates | src/Microsoft.CodeAnalysis.SyntaxTree/MetadataReference/AssemblyMetadata.cs | 20,073 | C# |
using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;
using SubSonic;
using SubSonic.Utilities;
namespace DalSic
{
/// <summary>
/// Strongly-typed collection for the PnCalculaPrecio class.
/// </summary>
[Serializable]
public partial class PnCalculaPrecioCollection : ActiveList<PnCalculaPrecio, PnCalculaPrecioCollection>
{
public PnCalculaPrecioCollection() {}
/// <summary>
/// Filters an existing collection based on the set criteria. This is an in-memory filter
/// Thanks to developingchris for this!
/// </summary>
/// <returns>PnCalculaPrecioCollection</returns>
public PnCalculaPrecioCollection Filter()
{
for (int i = this.Count - 1; i > -1; i--)
{
PnCalculaPrecio o = this[i];
foreach (SubSonic.Where w in this.wheres)
{
bool remove = false;
System.Reflection.PropertyInfo pi = o.GetType().GetProperty(w.ColumnName);
if (pi.CanRead)
{
object val = pi.GetValue(o, null);
switch (w.Comparison)
{
case SubSonic.Comparison.Equals:
if (!val.Equals(w.ParameterValue))
{
remove = true;
}
break;
}
}
if (remove)
{
this.Remove(o);
break;
}
}
}
return this;
}
}
/// <summary>
/// This is an ActiveRecord class which wraps the PN_calcula_precio table.
/// </summary>
[Serializable]
public partial class PnCalculaPrecio : ActiveRecord<PnCalculaPrecio>, IActiveRecord
{
#region .ctors and Default Settings
public PnCalculaPrecio()
{
SetSQLProps();
InitSetDefaults();
MarkNew();
}
private void InitSetDefaults() { SetDefaults(); }
public PnCalculaPrecio(bool useDatabaseDefaults)
{
SetSQLProps();
if(useDatabaseDefaults)
ForceDefaults();
MarkNew();
}
public PnCalculaPrecio(object keyID)
{
SetSQLProps();
InitSetDefaults();
LoadByKey(keyID);
}
public PnCalculaPrecio(string columnName, object columnValue)
{
SetSQLProps();
InitSetDefaults();
LoadByParam(columnName,columnValue);
}
protected static void SetSQLProps() { GetTableSchema(); }
#endregion
#region Schema and Query Accessor
public static Query CreateQuery() { return new Query(Schema); }
public static TableSchema.Table Schema
{
get
{
if (BaseSchema == null)
SetSQLProps();
return BaseSchema;
}
}
private static void GetTableSchema()
{
if(!IsSchemaInitialized)
{
//Schema declaration
TableSchema.Table schema = new TableSchema.Table("PN_calcula_precio", TableType.Table, DataService.GetInstance("sicProvider"));
schema.Columns = new TableSchema.TableColumnCollection();
schema.SchemaName = @"dbo";
//columns
TableSchema.TableColumn colvarIdCalculaPrecio = new TableSchema.TableColumn(schema);
colvarIdCalculaPrecio.ColumnName = "id_calcula_precio";
colvarIdCalculaPrecio.DataType = DbType.Int32;
colvarIdCalculaPrecio.MaxLength = 0;
colvarIdCalculaPrecio.AutoIncrement = true;
colvarIdCalculaPrecio.IsNullable = false;
colvarIdCalculaPrecio.IsPrimaryKey = true;
colvarIdCalculaPrecio.IsForeignKey = false;
colvarIdCalculaPrecio.IsReadOnly = false;
colvarIdCalculaPrecio.DefaultSetting = @"";
colvarIdCalculaPrecio.ForeignKeyTableName = "";
schema.Columns.Add(colvarIdCalculaPrecio);
TableSchema.TableColumn colvarPracticaVincula = new TableSchema.TableColumn(schema);
colvarPracticaVincula.ColumnName = "practica_vincula";
colvarPracticaVincula.DataType = DbType.AnsiStringFixedLength;
colvarPracticaVincula.MaxLength = 5;
colvarPracticaVincula.AutoIncrement = false;
colvarPracticaVincula.IsNullable = true;
colvarPracticaVincula.IsPrimaryKey = false;
colvarPracticaVincula.IsForeignKey = false;
colvarPracticaVincula.IsReadOnly = false;
colvarPracticaVincula.DefaultSetting = @"";
colvarPracticaVincula.ForeignKeyTableName = "";
schema.Columns.Add(colvarPracticaVincula);
TableSchema.TableColumn colvarObjPrestacionVincula = new TableSchema.TableColumn(schema);
colvarObjPrestacionVincula.ColumnName = "obj_prestacion_vincula";
colvarObjPrestacionVincula.DataType = DbType.AnsiStringFixedLength;
colvarObjPrestacionVincula.MaxLength = 5;
colvarObjPrestacionVincula.AutoIncrement = false;
colvarObjPrestacionVincula.IsNullable = false;
colvarObjPrestacionVincula.IsPrimaryKey = false;
colvarObjPrestacionVincula.IsForeignKey = false;
colvarObjPrestacionVincula.IsReadOnly = false;
colvarObjPrestacionVincula.DefaultSetting = @"";
colvarObjPrestacionVincula.ForeignKeyTableName = "";
schema.Columns.Add(colvarObjPrestacionVincula);
TableSchema.TableColumn colvarDiagnostico = new TableSchema.TableColumn(schema);
colvarDiagnostico.ColumnName = "diagnostico";
colvarDiagnostico.DataType = DbType.AnsiStringFixedLength;
colvarDiagnostico.MaxLength = 5;
colvarDiagnostico.AutoIncrement = false;
colvarDiagnostico.IsNullable = true;
colvarDiagnostico.IsPrimaryKey = false;
colvarDiagnostico.IsForeignKey = false;
colvarDiagnostico.IsReadOnly = false;
colvarDiagnostico.DefaultSetting = @"";
colvarDiagnostico.ForeignKeyTableName = "";
schema.Columns.Add(colvarDiagnostico);
TableSchema.TableColumn colvarGrupoEtareo = new TableSchema.TableColumn(schema);
colvarGrupoEtareo.ColumnName = "grupo_etareo";
colvarGrupoEtareo.DataType = DbType.AnsiString;
colvarGrupoEtareo.MaxLength = -1;
colvarGrupoEtareo.AutoIncrement = false;
colvarGrupoEtareo.IsNullable = false;
colvarGrupoEtareo.IsPrimaryKey = false;
colvarGrupoEtareo.IsForeignKey = false;
colvarGrupoEtareo.IsReadOnly = false;
colvarGrupoEtareo.DefaultSetting = @"";
colvarGrupoEtareo.ForeignKeyTableName = "";
schema.Columns.Add(colvarGrupoEtareo);
TableSchema.TableColumn colvarSexo = new TableSchema.TableColumn(schema);
colvarSexo.ColumnName = "sexo";
colvarSexo.DataType = DbType.AnsiStringFixedLength;
colvarSexo.MaxLength = 1;
colvarSexo.AutoIncrement = false;
colvarSexo.IsNullable = false;
colvarSexo.IsPrimaryKey = false;
colvarSexo.IsForeignKey = false;
colvarSexo.IsReadOnly = false;
colvarSexo.DefaultSetting = @"";
colvarSexo.ForeignKeyTableName = "";
schema.Columns.Add(colvarSexo);
BaseSchema = schema;
//add this schema to the provider
//so we can query it later
DataService.Providers["sicProvider"].AddSchema("PN_calcula_precio",schema);
}
}
#endregion
#region Props
[XmlAttribute("IdCalculaPrecio")]
[Bindable(true)]
public int IdCalculaPrecio
{
get { return GetColumnValue<int>(Columns.IdCalculaPrecio); }
set { SetColumnValue(Columns.IdCalculaPrecio, value); }
}
[XmlAttribute("PracticaVincula")]
[Bindable(true)]
public string PracticaVincula
{
get { return GetColumnValue<string>(Columns.PracticaVincula); }
set { SetColumnValue(Columns.PracticaVincula, value); }
}
[XmlAttribute("ObjPrestacionVincula")]
[Bindable(true)]
public string ObjPrestacionVincula
{
get { return GetColumnValue<string>(Columns.ObjPrestacionVincula); }
set { SetColumnValue(Columns.ObjPrestacionVincula, value); }
}
[XmlAttribute("Diagnostico")]
[Bindable(true)]
public string Diagnostico
{
get { return GetColumnValue<string>(Columns.Diagnostico); }
set { SetColumnValue(Columns.Diagnostico, value); }
}
[XmlAttribute("GrupoEtareo")]
[Bindable(true)]
public string GrupoEtareo
{
get { return GetColumnValue<string>(Columns.GrupoEtareo); }
set { SetColumnValue(Columns.GrupoEtareo, value); }
}
[XmlAttribute("Sexo")]
[Bindable(true)]
public string Sexo
{
get { return GetColumnValue<string>(Columns.Sexo); }
set { SetColumnValue(Columns.Sexo, value); }
}
#endregion
//no foreign key tables defined (0)
//no ManyToMany tables defined (0)
#region ObjectDataSource support
/// <summary>
/// Inserts a record, can be used with the Object Data Source
/// </summary>
public static void Insert(string varPracticaVincula,string varObjPrestacionVincula,string varDiagnostico,string varGrupoEtareo,string varSexo)
{
PnCalculaPrecio item = new PnCalculaPrecio();
item.PracticaVincula = varPracticaVincula;
item.ObjPrestacionVincula = varObjPrestacionVincula;
item.Diagnostico = varDiagnostico;
item.GrupoEtareo = varGrupoEtareo;
item.Sexo = varSexo;
if (System.Web.HttpContext.Current != null)
item.Save(System.Web.HttpContext.Current.User.Identity.Name);
else
item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
}
/// <summary>
/// Updates a record, can be used with the Object Data Source
/// </summary>
public static void Update(int varIdCalculaPrecio,string varPracticaVincula,string varObjPrestacionVincula,string varDiagnostico,string varGrupoEtareo,string varSexo)
{
PnCalculaPrecio item = new PnCalculaPrecio();
item.IdCalculaPrecio = varIdCalculaPrecio;
item.PracticaVincula = varPracticaVincula;
item.ObjPrestacionVincula = varObjPrestacionVincula;
item.Diagnostico = varDiagnostico;
item.GrupoEtareo = varGrupoEtareo;
item.Sexo = varSexo;
item.IsNew = false;
if (System.Web.HttpContext.Current != null)
item.Save(System.Web.HttpContext.Current.User.Identity.Name);
else
item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
}
#endregion
#region Typed Columns
public static TableSchema.TableColumn IdCalculaPrecioColumn
{
get { return Schema.Columns[0]; }
}
public static TableSchema.TableColumn PracticaVinculaColumn
{
get { return Schema.Columns[1]; }
}
public static TableSchema.TableColumn ObjPrestacionVinculaColumn
{
get { return Schema.Columns[2]; }
}
public static TableSchema.TableColumn DiagnosticoColumn
{
get { return Schema.Columns[3]; }
}
public static TableSchema.TableColumn GrupoEtareoColumn
{
get { return Schema.Columns[4]; }
}
public static TableSchema.TableColumn SexoColumn
{
get { return Schema.Columns[5]; }
}
#endregion
#region Columns Struct
public struct Columns
{
public static string IdCalculaPrecio = @"id_calcula_precio";
public static string PracticaVincula = @"practica_vincula";
public static string ObjPrestacionVincula = @"obj_prestacion_vincula";
public static string Diagnostico = @"diagnostico";
public static string GrupoEtareo = @"grupo_etareo";
public static string Sexo = @"sexo";
}
#endregion
#region Update PK Collections
#endregion
#region Deep Save
#endregion
}
}
| 29.817955 | 167 | 0.663963 | [
"MIT"
] | saludnqn/Empadronamiento | DalSic/generated/PnCalculaPrecio.cs | 11,957 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace HousingTenant.Business.Library.Models
{
public class ComplaintRequest : ARequest
{
public IPerson Accused { get; set; }
public override int CompareTo(ARequest other)
{
if(other != null && other.GetType() == GetType())
{
var otherRequest = other as ComplaintRequest;
var thisRequestString = string.Format("{0} {1} {2} {3}",
Initiator, Accused,Description,(Status == "Hold" || Status == "Pending" ? "Pending" : "Completed"));
var otherRequestString = string.Format("{0} {1} {2} {3}",
otherRequest.Initiator, otherRequest.Accused, otherRequest.Description, (otherRequest.Status == "Hold" || otherRequest.Status == "Pending" ? "Pending" : "Completed"));
return thisRequestString.CompareTo(otherRequestString);
}
return -1;
}
public override bool IsValid()
{
return Accused != null && Initiator != null && Description != null;
}
public override string ToString()
{
return string.Format("{0}\nAccused: {1} Complaint: {2}",
base.ToString(), Accused.GetFullName(), Description);
}
}
}
| 36.078947 | 186 | 0.557987 | [
"MIT"
] | revaturelabs/housing-tenant | HousingTenant.Business/HousingTenant.Business.Library/Models/ComplaintRequest.cs | 1,373 | C# |
using banditoth.Forms.RecurrenceToolkit.Logging.Enumerations;
using SQLite;
using System;
using System.Collections.Generic;
using System.Text;
namespace banditoth.Forms.RecurrenceToolkit.Logging.SQLite.Entities
{
public class Log
{
[AutoIncrement]
[PrimaryKey]
public long Id { get; set; }
public DateTime Date { get; set; }
public LogLevel Level { get; set; }
public string Message { get; set; }
}
}
| 19.136364 | 67 | 0.738717 | [
"MIT"
] | banditoth/Forms.RecurrenceToolkit | banditoth.Forms.RecurrenceToolkit/banditoth.Forms.RecurrenceToolkit.Logging.SQLite/Entities/Log.cs | 423 | C# |
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Cosmos.IL2CPU.Plugs;
namespace Cosmos.Core.Plugs.System.IO
{
[Plug(TargetName = "System.IO.PathHelper")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public static class PathHelperImpl
{
public static unsafe void Ctor(ref object aThis, char* aCharArrayPtr, int aLength,
[FieldAccess(Name = "System.Boolean System.IO.PathHelper.doNotTryExpandShortFileName")] ref bool mDoNotTryExpandShortFileName,
[FieldAccess(Name = "System.Char* System.IO.PathHelper.m_arrayPtr")] ref char* mArrayPtr,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_capacity")] ref int mCapacity,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_length")] ref int mLength,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_maxPath")] ref int mMaxPath,
[FieldAccess(Name = "System.Boolean System.IO.PathHelper.useStackAlloc")] ref bool mUseStackAlloc
)
{
mLength = 0;
mCapacity = aLength;
mArrayPtr = aCharArrayPtr;
mUseStackAlloc = true;
}
public static unsafe void Ctor(ref object aThis, int aCapacity, int aMaxPath,
[FieldAccess(Name = "System.Boolean System.IO.PathHelper.doNotTryExpandShortFileName")] ref bool mDoNotTryExpandShortFileName,
[FieldAccess(Name = "System.Char* System.IO.PathHelper.m_arrayPtr")] ref char* mArrayPtr,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_capacity")] ref int mCapacity,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_length")] ref int mLength,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_maxPath")] ref int mMaxPath,
[FieldAccess(Name = "System.Boolean System.IO.PathHelper.useStackAlloc")] ref bool mUseStackAlloc)
{
mLength = 0;
mCapacity = aCapacity;
mUseStackAlloc = true;
}
public static int get_Capacity(ref object aThis,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_capacity")] ref int mCapacity)
{
return mCapacity;
}
public static unsafe char get_Item(ref object aThis, int aIndex,
[FieldAccess(Name = "System.Char* System.IO.PathHelper.m_arrayPtr")] ref char* mArrayPtr)
{
return mArrayPtr[aIndex];
}
public static unsafe void set_Item(ref object aThis, int aIndex, char aValue,
[FieldAccess(Name = "System.Char* System.IO.PathHelper.m_arrayPtr")] ref char* mArrayPtr)
{
mArrayPtr[aIndex] = aValue;
}
public static int get_Length(ref object aThis,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_length")] ref int mLength)
{
return mLength;
}
public static void set_Length(ref object aThis, int aValue,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_length")] ref int mLength)
{
mLength = aValue;
}
public static unsafe void Append(ref object aThis, char aValue,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_capacity")] ref int mCapacity,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_length")] ref int mLength,
[FieldAccess(Name = "System.Char* System.IO.PathHelper.m_arrayPtr")] ref char* mArrayPtr)
{
if (mLength + 1 > mCapacity)
{
throw new PathTooLongException();
}
mArrayPtr[mLength] = aValue;
mLength++;
}
public static unsafe int GetFullPathName(ref object aThis,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_length")] ref int mLength,
[FieldAccess(Name = "System.Char* System.IO.PathHelper.m_arrayPtr")] ref char* mArrayPtr)
{
int xLength = 0;
while (*mArrayPtr != '\0')
{
xLength++;
mArrayPtr++;
}
mLength = xLength;
return xLength;
}
public static unsafe string ToString(ref object aThis,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_length")] ref int mLength,
[FieldAccess(Name = "System.Char* System.IO.PathHelper.m_arrayPtr")] ref char* mArrayPtr)
{
return new string(mArrayPtr, 0, mLength);
}
public static unsafe bool TryExpandShortFileName(ref object aThis,
[FieldAccess(Name = "System.Int32 System.IO.PathHelper.m_length")] ref int mLength,
[FieldAccess(Name = "System.Char* System.IO.PathHelper.m_arrayPtr")] ref char* mArrayPtr)
{
int xLength = 0;
while (*mArrayPtr != '\0')
{
xLength++;
mArrayPtr++;
}
mLength = xLength;
return true;
}
}
}
| 41.614754 | 138 | 0.608627 | [
"BSD-3-Clause"
] | ERamaM/Cosmos | source/Cosmos.Core.Plugs/System/IO/PathHelperImpl.cs | 5,079 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
namespace Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support
{
/// <summary>Argument completer implementation for Month.</summary>
[System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.DataProtection.Support.MonthTypeConverter))]
public partial struct Month :
System.Management.Automation.IArgumentCompleter
{
/// <summary>
/// Implementations of this function are called by PowerShell to complete arguments.
/// </summary>
/// <param name="commandName">The name of the command that needs argument completion.</param>
/// <param name="parameterName">The name of the parameter that needs argument completion.</param>
/// <param name="wordToComplete">The (possibly empty) word being completed.</param>
/// <param name="commandAst">The command ast in case it is needed for completion.</param>
/// <param name="fakeBoundParameters">This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot
/// or will not attempt to evaluate an argument, in which case you may need to use commandAst.</param>
/// <returns>
/// A collection of completion results, most like with ResultType set to ParameterValue.
/// </returns>
public global::System.Collections.Generic.IEnumerable<global::System.Management.Automation.CompletionResult> CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters)
{
if (global::System.String.IsNullOrEmpty(wordToComplete) || "April".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'April'", "April", global::System.Management.Automation.CompletionResultType.ParameterValue, "April");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "August".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'August'", "August", global::System.Management.Automation.CompletionResultType.ParameterValue, "August");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "December".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'December'", "December", global::System.Management.Automation.CompletionResultType.ParameterValue, "December");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "February".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'February'", "February", global::System.Management.Automation.CompletionResultType.ParameterValue, "February");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "January".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'January'", "January", global::System.Management.Automation.CompletionResultType.ParameterValue, "January");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "July".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'July'", "July", global::System.Management.Automation.CompletionResultType.ParameterValue, "July");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "June".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'June'", "June", global::System.Management.Automation.CompletionResultType.ParameterValue, "June");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "March".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'March'", "March", global::System.Management.Automation.CompletionResultType.ParameterValue, "March");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "May".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'May'", "May", global::System.Management.Automation.CompletionResultType.ParameterValue, "May");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "November".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'November'", "November", global::System.Management.Automation.CompletionResultType.ParameterValue, "November");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "October".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'October'", "October", global::System.Management.Automation.CompletionResultType.ParameterValue, "October");
}
if (global::System.String.IsNullOrEmpty(wordToComplete) || "September".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase))
{
yield return new global::System.Management.Automation.CompletionResult("'September'", "September", global::System.Management.Automation.CompletionResultType.ParameterValue, "September");
}
}
}
} | 85.582278 | 373 | 0.709658 | [
"MIT"
] | Agazoth/azure-powershell | src/DataProtection/generated/api/Support/Month.Completer.cs | 6,683 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace RPEx
{
public static class Class1
{
public Class1()
{
var dateStr = Expression.Parameter(typeof(IObservable<bool>));
var dateStr2 = Expression.Parameter(typeof(bool));
//var asDateTime = Expression.Call(typeof(DateTime), "Parse", null, dateStr); // calls static method "DateTime.Parse"
//var call = Expression.Call(typeof(ReactiveCommandExtensions), "ToReactiveCommand", x, new[] { dateStr, dateStr2 });
var call = Expression.Call(typeof(ReactiveCommandExtensions), "ToReactiveCommand", null, new[] { dateStr, dateStr2 });
//var fmtExpr = Expression.Constant("MM/dd/yyyy");
//var body = Expression.Call(asDateTime, "ToString", null, fmtExpr); // calls instance method "DateTime.ToString(string)"
var lambdaExpr = Expression.Lambda<Func<IObservable<bool>, bool, object>>(call, dateStr, dateStr2);
var command2 = lambdaExpr.Compile().Invoke(A.Select(_ => true), true);
}
public static ReactiveProperty<T> ToReactiveProperty<T>(this ApplicationSettingsBase settings, string propertyName)
{
var propertyInfo = settings.GetType().GetProperty(propertyName);
var reactiveProperty = new ReactiveProperty<T>((T)propertyInfo.GetValue(settings));
settings.PropertyChanged += (s, e) => reactiveProperty.Value = (T)propertyInfo.GetValue(settings);
reactiveProperty.Subscribe(t => propertyInfo.SetValue(settings, t));
return reactiveProperty;
}
internal static Type[] GetReactivePropertyTypeArguments(this object property)
{
if (property == null) throw new ArgumentNullException(nameof(property));
var reactivePropertyType =
property.GetType().GetInterfaces().FirstOrDefault(
x => x.IsGenericType
&& x.GetGenericTypeDefinition() == typeof(IReactiveProperty<>));
return reactivePropertyType != null ? reactivePropertyType.GetGenericArguments() : null;
}
internal static Type[] GetReactiveCommandTypeArguments(this object property)
{
if (property == null) throw new ArgumentNullException(nameof(property));
for (var propertyType = property.GetType(); propertyType != typeof(object); propertyType = propertyType.BaseType)
{
if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(ReactiveCommand<>))
{
return propertyType.GenericTypeArguments;
}
}
return null;
}
internal static Type[] GetReactiveCommandTypeArguments<T>(this T instance, string propertyName)
{
var propertyType = instance.GetType().GetProperty(propertyName).PropertyType;
do
{
if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(ReactiveCommand<>))
{
return propertyType.GenericTypeArguments;
}
propertyType = propertyType.BaseType;
} while (propertyType != typeof(object));
return null;
}
internal static Type[] GetAsyncReactiveCommandTypeArguments(this object property)
{
if (property == null) throw new ArgumentNullException(nameof(property));
for (var propertyType = property.GetType(); propertyType != null && propertyType != typeof(object); propertyType = propertyType.BaseType)
{
if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(AsyncReactiveCommand<>))
{
return propertyType.GenericTypeArguments;
}
}
return null;
}
}
}
| 31.20155 | 149 | 0.613665 | [
"MIT"
] | tmknakamu/RPEx | RPEx/RPEx/Class1.cs | 4,027 | C# |
using java.lang;
public class GenericClass2<T> {
public T get(T t) {
return t;
}
public static string test(string s) {
return new GenericClass2<string>().get(s);
}
} | 16 | 44 | 0.670455 | [
"Apache-2.0"
] | monoman/cnatural-language | tests/resources/ObjectModelTest/sources/GenericClass2.stab.cs | 176 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Ch04_01VertexSkinning
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
| 18.095238 | 37 | 0.692105 | [
"MIT"
] | AndreGuimRua/Direct3D-Rendering-Cookbook | Ch04_01VertexSkinning/Form1.cs | 382 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using U_System.External.GitHub.Internal;
using U_System.External.Plugin;
using U_System.UX;
namespace U_System.Core.Plugins.Models
{
public class Plugin : ViewModelBase
{
public int Id { get => id; set { id = value; OnPropertyChanged(); } }
public string Name { get => name; set { name = value; OnPropertyChanged(); } }
public string Description { get => description; set { description = value; OnPropertyChanged(); } }
/// <summary>
/// The Current Release Load or to load
/// </summary>
public Release CurrentRelease { get => currentRelease; set { currentRelease = value; OnPropertyChanged(); } }
[JsonIgnore]
public Release Release { get => release; set { release = value; OnPropertyChanged(); } }
/// <summary>
/// All release from the GitHub Repository
/// </summary>
[JsonIgnore]
public Release[]? Releases { get => releases; set { releases = value; OnPropertyChanged(); } }
[JsonIgnore]
public bool IsWorking { get => isWorking; set { isWorking = value; OnPropertyChanged(); } }
public int GitHubRepositoryID { get => gitHubRepositoryID; set { gitHubRepositoryID = value; OnPropertyChanged(); } }
public string GitHubRepositoryURL { get => gitHubRepositoryURL; set { gitHubRepositoryURL = value; OnPropertyChanged(); } }
public bool AutomaticUpdates { get => automaticUpdates; set { automaticUpdates = value; OnPropertyChanged(); } }
public bool CanDownload { get => canDownload; set { canDownload = value; OnPropertyChanged(); } }
public PluginStatus PluginStatus { get => pluginStatus; set { pluginStatus = value; OnPropertyChanged(); } }
public string[] Files { get => files; set { files = value; OnPropertyChanged(); } }
public string[] Runtimes { get => runtimes; set { runtimes = value; OnPropertyChanged(); } }
// ---------- INTERALS -------------
internal object AssemblyContext { get => assemblyContext; set => assemblyContext = value; }
internal object Assembly { get => assembly; set => assembly = value; }
internal Module[] Modules { get => modules; set => modules = value; }
internal List<object> Tabs { get => tabs; set => tabs = value; }
internal List<object> MenuItems { get => menuItems; set => menuItems = value; }
// --------- PRIVATES --------------
private int id;
private string name;
private string description;
private Release currentRelease;
private Release release;
private Release[] releases;
private bool isWorking;
private int gitHubRepositoryID;
private string gitHubRepositoryURL;
private bool automaticUpdates;
private bool canDownload;
private PluginStatus pluginStatus;
private string[] files;
private string[] runtimes;
private object assemblyContext;
private object assembly;
private Module[] modules;
private List<object> tabs;
private List<object> menuItems;
}
}
| 41.544304 | 131 | 0.638026 | [
"MIT"
] | WinterStudios/U-System | U-System.Core/Plugins/Models/Plugin.cs | 3,284 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the application-insights-2018-11-25.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.ApplicationInsights.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.ApplicationInsights.Model.Internal.MarshallTransformations
{
/// <summary>
/// CreateLogPattern Request Marshaller
/// </summary>
public class CreateLogPatternRequestMarshaller : IMarshaller<IRequest, CreateLogPatternRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((CreateLogPatternRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(CreateLogPatternRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.ApplicationInsights");
string target = "EC2WindowsBarleyService.CreateLogPattern";
request.Headers["X-Amz-Target"] = target;
request.Headers["Content-Type"] = "application/x-amz-json-1.1";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2018-11-25";
request.HttpMethod = "POST";
request.ResourcePath = "/";
request.MarshallerVersion = 2;
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetPattern())
{
context.Writer.WritePropertyName("Pattern");
context.Writer.Write(publicRequest.Pattern);
}
if(publicRequest.IsSetPatternName())
{
context.Writer.WritePropertyName("PatternName");
context.Writer.Write(publicRequest.PatternName);
}
if(publicRequest.IsSetPatternSetName())
{
context.Writer.WritePropertyName("PatternSetName");
context.Writer.Write(publicRequest.PatternSetName);
}
if(publicRequest.IsSetRank())
{
context.Writer.WritePropertyName("Rank");
context.Writer.Write(publicRequest.Rank);
}
if(publicRequest.IsSetResourceGroupName())
{
context.Writer.WritePropertyName("ResourceGroupName");
context.Writer.Write(publicRequest.ResourceGroupName);
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static CreateLogPatternRequestMarshaller _instance = new CreateLogPatternRequestMarshaller();
internal static CreateLogPatternRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static CreateLogPatternRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 36.170543 | 147 | 0.609087 | [
"Apache-2.0"
] | DetlefGolze/aws-sdk-net | sdk/src/Services/ApplicationInsights/Generated/Model/Internal/MarshallTransformations/CreateLogPatternRequestMarshaller.cs | 4,666 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using LASI.Content;
using LASI.Utilities;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc;
namespace LASI.WebApp.Controllers.Helpers
{
public static class FileUploadHelper
{
public static bool IsAcceptedContentType(this IFormFile formFile) => AcceptedContentTypes.Contains(formFile.ContentType);
public static string ExtractFileName(this IFormFile formFile) => formFile.ContentDisposition.SplitRemoveEmpty(';')
.Select(s => s.Trim())
.First(p => p.StartsWith("filename", StringComparison.OrdinalIgnoreCase))
.Substring(9).Trim('\"');
private static readonly ISet<string> AcceptedContentTypes = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
"text/plain", // generally corresponds to .txt
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", // generally corresponds to .docx
"application/msword", // generally corresponds to .doc
"application/pdf" // generally corresponds to .pdf
};
}
} | 38.870968 | 129 | 0.714523 | [
"MIT"
] | aluanhaddad/LASI | LASI.WebApp/Controllers/Helpers/FileUploadHelper.cs | 1,207 | C# |
//using Magicodes.ExporterAndImporter.Core.Models;
//using System;
//using System.Collections.Generic;
//using System.Text;
//using System.Threading.Tasks;
//namespace ExcelDemo
//{
// /// <summary>
// /// 导入
// /// </summary>
// public interface IImporter
// {
// /// <summary>
// /// 生成Excel导入模板
// /// </summary>
// /// <typeparam name="T"></typeparam>
// /// <returns></returns>
// Task<TemplateFileInfo> GenerateTemplate<T>(string fileName) where T : class, new();
// /// <summary>
// /// 生成Excel导入模板
// /// </summary>
// /// <typeparam name="T"></typeparam>
// /// <returns>二进制字节</returns>
// Task<byte[]> GenerateTemplateBytes<T>() where T : class, new();
// /// <summary>
// /// 导入模型验证数据
// /// </summary>
// /// <typeparam name="T"></typeparam>
// /// <param name="filePath"></param>
// /// <returns></returns>
// Task<ImportResult<T>> Import<T>(string filePath) where T : class, new();
// }
//}
| 29.081081 | 93 | 0.513011 | [
"MIT"
] | zhaobingwang/sample | Demo/Magicodes.IE.Demo/ExcelDemo/IImporter.cs | 1,132 | C# |
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Agri.Models.Configuration
{
public class SoilTestPotassiumKelownaRange : Versionable
{
public SoilTestPotassiumKelownaRange()
{
SoilTestPotassiumRecommendations = new List<SoilTestPotassiumRecommendation>();
}
[Key]
public int Id { get; set; }
public string Range { get; set; }
public int RangeLow { get; set; }
public int RangeHigh { get; set; }
public List<SoilTestPotassiumRecommendation> SoilTestPotassiumRecommendations { get; set; }
}
} | 31.5 | 99 | 0.67619 | [
"Apache-2.0"
] | bcgov/agri-nmp | app/Agri.Models/Configuration/SoilTestPotassiumKelownaRange.cs | 632 | C# |
using System;
using System.Security.Claims;
using Newtonsoft.Json;
using Prime.Models;
namespace Prime.ViewModels.Parties
{
public class AuthorizedUserViewModel : IUserBoundModel
{
public int Id { get; set; }
public Guid UserId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string GivenNames { get; set; }
public DateTime DateOfBirth { get; set; }
public string PreferredFirstName { get; set; }
public string PreferredMiddleName { get; set; }
public string PreferredLastName { get; set; }
public PhysicalAddress PhysicalAddress { get; set; }
public VerifiedAddress VerifiedAddress { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string SmsPhone { get; set; }
public string JobRoleTitle { get; set; }
public string EmploymentIdentifier { get; set; }
public HealthAuthorityCode HealthAuthorityCode { get; set; }
public AccessStatusType Status { get; set; }
}
}
| 36.9 | 68 | 0.6486 | [
"Apache-2.0"
] | WadeBarnes/moh-prime | prime-dotnet-webapi/ViewModels/Parties/AuthorizedUserViewModel.cs | 1,107 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Dicom.Network {
public class DicomNEventReportResponse : DicomResponse {
public DicomNEventReportResponse(DicomDataset command) : base(command) {
}
public DicomNEventReportResponse(DicomNEventReportRequest request, DicomStatus status) : base(request, status) {
}
public DicomUID SOPInstanceUID {
get { return Command.Get<DicomUID>(DicomTag.AffectedSOPInstanceUID); }
private set { Command.Add(DicomTag.AffectedSOPInstanceUID, value); }
}
public ushort EventTypeID {
get { return Command.Get<ushort>(DicomTag.EventTypeID); }
private set { Command.Add(DicomTag.EventTypeID, value); }
}
public override string ToString() {
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0} [{1}]: {2}", ToString(Type), RequestMessageID, Status.Description);
sb.AppendFormat("\n\t\tEvent Type: {0:x4}", EventTypeID);
if (Status.State != DicomState.Pending && Status.State != DicomState.Success) {
if (!String.IsNullOrEmpty(Status.ErrorComment))
sb.AppendFormat("\n\t\tError: {0}", Status.ErrorComment);
}
return sb.ToString();
}
}
}
| 32.972222 | 114 | 0.727043 | [
"BSD-3-Clause"
] | chunhuxiao/fo-dicom | DICOM/Network/DicomNEventReportResponse.cs | 1,189 | C# |
// This file isn't generated, but this comment is necessary to exclude it from StyleCop analysis.
// For more info see: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2108
// <auto-generated/>
// Copyright (c) Nate McMaster.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel.DataAnnotations;
namespace McMaster.Extensions.CommandLineUtils.Validation
{
/// <summary>
/// Provides validation for a <see cref="CommandOption"/>.
/// </summary>
internal interface IOptionValidator
{
/// <summary>
/// Validates the values specified for <see cref="CommandOption.Values"/>.
/// </summary>
/// <param name="option">The option.</param>
/// <param name="context">The validation context.</param>
/// <returns>The validation result. Returns <see cref="ValidationResult.Success"/> if the values pass validation.</returns>
ValidationResult GetValidationResult(CommandOption option, ValidationContext context);
}
}
| 41.769231 | 131 | 0.70442 | [
"MIT"
] | nseedio/nseed | lab/SeedingWeedingOutAndDestroyingStartup/NSeed/ThirdParty/CommandLineUtils/Validation/IOptionValidator.cs | 1,086 | C# |
namespace OpenTracing.Propagation
{
/// <summary>
/// Format instances control the behavior of <see cref="ITracer.Inject{TCarrier}"/> and
/// <see cref="ITracer.Extract{TCarrier}"/> (and also constrain the type of the carrier parameter to same). Most
/// OpenTracing users will only reference the <see cref="BuiltinFormats"/> constants. For example:
/// <code>
/// Tracer tracer = ...
/// IFormat{ITextMap} httpCarrier = new AnHttpHeaderCarrier(httpRequest);
/// ISpanContext spanCtx = tracer.Extract(BuiltinFormats.HttpHeaders, httpHeaderRequest);
/// </code>
/// </summary>
/// <seealso cref="ITracer.Inject{TCarrier}"/>
/// <seealso cref="ITracer.Extract{TCarrier}"/>
public interface IFormat<TCarrier>
{
}
}
| 40.684211 | 116 | 0.670116 | [
"Apache-2.0"
] | Falco20019/opentracing-csharp | src/OpenTracing/Propagation/IFormat.cs | 775 | C# |
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using LinearAlgebra;
namespace MathVectorTests
{
[TestClass]
public class MathVectorTest
{
[TestMethod]
public void TestDimensions()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
int expected = 4;
int result = vector.Dimensions;
Assert.AreEqual(expected, result);
}
[TestMethod]
public void TestIndex()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
int i = 1;
double expected = 0;
double result = vector[i];
Assert.AreEqual(expected, result);
}
[TestMethod]
public void TestIndexSet()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
vector[1] = 5;
var expected = new MathVector(new double[] { 1, 5, 3, 5 });
Assert.IsTrue(expected == vector);
}
[TestMethod]
public void TestIndexSetException()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
int i = -1;
var expected = new MathVector(new double[] { 1, 5, 3, 5 });
Assert.IsTrue(expected == vector);
Assert.ThrowsException<System.Exception>(() => vector[i] = 6);
}
[TestMethod]
public void TestIndexSetExceptionPlus()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
int i = 100;
var expected = new MathVector(new double[] { 1, 5, 3, 5 });
Assert.IsTrue(expected == vector);
Assert.ThrowsException<System.Exception>(() => vector[i] = 6);
}
[TestMethod]
public void TestIndexExceptionMinus()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
int i = -1;
Assert.ThrowsException<System.Exception>(()=> vector[i]);
}
[TestMethod]
public void TestIndexMinusExceptionPlus()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
int i = 100;
Assert.ThrowsException<System.Exception>(() => vector[i]);
}
[TestMethod]
public void TestLengthPositive()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
double expected = 5.9160797;
double result = vector.Length;
Assert.AreEqual(expected, result, 0.0000001);
}
[TestMethod]
public void TestLengthNegative()
{
var vector = new MathVector(new double[] { -5 });
double expected = 5;
double result = vector.Length;
Assert.AreEqual(expected, result);
}
[TestMethod]
public void TestSumNumberPlus()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
var expected = new MathVector(new double[] { 4, 3, 6, 8 });
var result = (MathVector)vector.SumNumber(3);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestSumNumberFalse()
{
var vector = new MathVector(new double[] { 1, 4 });
var expected = new MathVector(new double[] { 5, 7 });
var result = (MathVector)vector.SumNumber(3);
Assert.IsFalse(expected == result);
}
[TestMethod]
public void TestSumNumberMinus()
{
var vector = new MathVector(new double[] { 1, 4 });
var expected = new MathVector(new double[] { -2, 1 });
var result = (MathVector)vector.SumNumber(-3);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestMultiplyNumberNegative()
{
var vector = new MathVector(new double[] { 1, 4 });
var expected = new MathVector(new double[] { -1, -4 });
var result = (MathVector)vector.MultiplyNumber(-1);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestMultiplyNumberNull()
{
var vector = new MathVector(new double[] { 1, 4 });
var expected = new MathVector(new double[] { 0, 0 });
var result = (MathVector)vector.MultiplyNumber(0);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestMultiplyNumberPosotive()
{
var vector = new MathVector(new double[] { 1, 4, 2 });
var expected = new MathVector(new double[] { 3, 12, 6 });
var result = (MathVector)vector.MultiplyNumber(3);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestMultiplyNumberFalse()
{
var vector = new MathVector(new double[] { 1, 4, 2 });
var expected = new MathVector(new double[] { 0, 12, 6 });
var result = (MathVector)vector.MultiplyNumber(3);
Assert.IsFalse(expected == result);
}
[TestMethod]
public void TestSum()
{
var vector = new MathVector(new double[] { 1, 4, 2 });
var vect2 = new MathVector(new double[] { 2, 3, 5 });
var expected = new MathVector(new double[] { 3, 7, 7 });
var result = (MathVector)vector.Sum(vect2);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestSumException()
{
var vector = new MathVector(new double[] { 1, 4, 2 });
var vect2 = new MathVector(new double[] { 2, 3 });
Assert.ThrowsException<System.Exception>(()=> (MathVector)vector.Sum(vect2));
}
[TestMethod]
public void TestMultiply()
{
var vector = new MathVector(new double[] { 1, 4, 2 });
var vect2 = new MathVector(new double[] { 2, 3, 5 });
var expected = new MathVector(new double[] { 2, 12, 10 });
var result = (MathVector)vector.Multiply(vect2);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestMultiplyException()
{
var vector = new MathVector(new double[] { 1, 4, 2 });
var vect2 = new MathVector(new double[] { 2, 3 });
Assert.ThrowsException<System.Exception>(()=> (MathVector)vector.Multiply(vect2));
}
[TestMethod]
public void TestMultiplyFalse()
{
var vector = new MathVector(new double[] { 1, 4, 2 });
var vect2 = new MathVector(new double[] { 2, 3, 5 });
var expected = new MathVector(new double[] { 2, 12, 1 });
var result = (MathVector)vector.Multiply(vect2);
Assert.IsFalse(expected == result);
}
[TestMethod]
public void TestDivide()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 1 });
var expected = new MathVector(new double[] { 2, 2, 2 });
var result = (MathVector)vector.Divide(vect2);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestDivideException()
{
var vector = new MathVector(new double[] { 1, 4, 2 });
var vect2 = new MathVector(new double[] { 2, 3 });
Assert.ThrowsException<Exception>(()=> (MathVector)vector.Divide(vect2));
}
[TestMethod]
public void TestDivideByZeroExceprion()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 0 });
Assert.ThrowsException<DivideByZeroException>(()=> (MathVector)vector.Divide(vect2));
}
[TestMethod]
public void TestDivideNumber()
{
var vector = new MathVector(new double[] { 5, 4, 37 });
var expected = new MathVector(new double[] { 2.5, 2, 18.5 });
var result = (MathVector)vector.DivideNumber(2);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestDivideNumberZeroExceprion()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
Assert.ThrowsException<DivideByZeroException>(()=> (MathVector)vector.DivideNumber(0));
}
[TestMethod]
public void TestScalar()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 0 });
double result = 26;
double expected = vector.ScalarMultiply(vect2);
Assert.AreEqual(expected, result);
}
[TestMethod]
public void TestScalarDiffLengthException()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2 });
Assert.ThrowsException<System.Exception>(()=> vector.ScalarMultiply(vect2));
}
[TestMethod]
public void TestCalcDistanceDiffLengthException()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2 });
Assert.ThrowsException<System.Exception>(()=> vector.CalcDistance(vect2));
}
[TestMethod]
public void TestCalcDistance()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 4 });
double result = 4.1231056;
double expected = vector.CalcDistance(vect2);
Assert.AreEqual(expected, result, 0.0000001);
}
[TestMethod]
public void TestOperatorPlusNumber()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
var expected = new MathVector(new double[] { 4, 3, 6, 8 });
var result = (MathVector)(vector + 3);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestOperatorPlusVector()
{
var vector = new MathVector(new double[] { 4, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 4 });
var expected = new MathVector(new double[] { 7, 6, 6 });
var result = (MathVector)(vector + vect2);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestOperatorPLusVectorException()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2 });
Assert.ThrowsException<System.Exception>(()=> (MathVector)(vector + vect2));
}
[TestMethod]
public void TestOperatorMinusNumber()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
var expected = new MathVector(new double[] { 0, -1, 2, 4 });
var result = (MathVector)(vector - 1);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestOperatorMinusVector()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 4 });
var expected = new MathVector(new double[] { 3, 2, -2 });
var result = (MathVector)(vector - vect2);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestOperatorMultiplyNumber()
{
var vector = new MathVector(new double[] { 1, 0, 3, 5 });
var expected = new MathVector(new double[] { 3, 0, 9, 15 });
var result = (MathVector)(vector * 3);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestOperatorMultiplyVector()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 4 });
var expected = new MathVector(new double[] { 18, 8, 8 });
var result = (MathVector)(vector * vect2);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestOperatorDivideNumber()
{
var vector = new MathVector(new double[] { 9, 0, 3, 12 });
var expected = new MathVector(new double[] { 3, 0, 1, 4 });
var result = (MathVector)(vector / 3);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestOperatorDivideVector()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 4 });
var expected = new MathVector(new double[] { 2, 2, 0.5 });
var result = (MathVector)(vector / vect2);
Assert.IsTrue(expected == result);
}
[TestMethod]
public void TestOperatorScalar()
{
var vector = new MathVector(new double[] { 6, 4, 2 });
var vect2 = new MathVector(new double[] { 3, 2, 0 });
double result = 26;
double expected = vector % vect2;
Assert.AreEqual(expected, result);
}
}
}
| 29.019313 | 99 | 0.521408 | [
"MIT"
] | ThirstB1ood/MathVector_CSharp | MathVectorTests/UnitTest1.cs | 13,525 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace SMBMessageParser.Models.NetworkStruct.Close
{
class CloseResponse : SMB2Body
{
readonly ushort _StructureSize = 60;
ushort _Flags;
readonly uint _Reserved = 0;
DateTimeOffset _CreationTime;
DateTimeOffset _LastAccessTime;
DateTimeOffset _LastWriteTime;
DateTimeOffset _ChangeTime;
ulong _AllocationSize;
ulong _EndofFile;
uint _FileAttributes;
public ushort StructureSize => _StructureSize;
public ushort Flags { get => _Flags; private set => _Flags = value; }
public uint Reserved => _Reserved;
public DateTimeOffset CreationTime { get => _CreationTime; private set => _CreationTime = value; }
public DateTimeOffset LastAccessTime { get => _LastAccessTime; private set => _LastAccessTime = value; }
public DateTimeOffset LastWriteTime { get => _LastWriteTime; private set => _LastWriteTime = value; }
public DateTimeOffset ChangeTime { get => _ChangeTime; private set => _ChangeTime = value; }
public ulong AllocationSize { get => _AllocationSize; private set => _AllocationSize = value; }
public ulong EndofFile { get => _EndofFile; private set => _EndofFile = value; }
public uint FileAttributes { get => _FileAttributes; private set => _FileAttributes = value; }
public override List<byte> DumpBinary()
{
throw new NotImplementedException();
}
public static CloseResponse Parser(byte[] vs, int offset)
{
return new CloseResponse(vs, offset);
}
CloseResponse(byte[] vs, int offset)
{
if (StructureSize != BitConverter.ToUInt16(vs, offset))//0-2
{
throw new Exception("StructureSize is not 60");
}
Flags = BitConverter.ToUInt16(vs, offset + 2);//2-2
if (Reserved != BitConverter.ToUInt32(vs, offset + 4))//4-4
{
throw new Exception("Reserved is not 0");
}
CreationTime = DateTimeOffset.FromFileTime(BitConverter.ToInt64(vs, offset + 8));//8-8
LastAccessTime = DateTimeOffset.FromFileTime(BitConverter.ToInt64(vs, offset + 16));//16-8
LastWriteTime = DateTimeOffset.FromFileTime(BitConverter.ToInt64(vs, offset + 24));//24-8
ChangeTime = DateTimeOffset.FromFileTime(BitConverter.ToInt64(vs, offset + 32));//32-8
AllocationSize = BitConverter.ToUInt64(vs, offset + 40);//40-8
EndofFile = BitConverter.ToUInt64(vs, offset + 48);//48-8
FileAttributes = BitConverter.ToUInt32(vs, offset + 56);//56-4
}
}
}
| 45.866667 | 112 | 0.636628 | [
"MIT"
] | tlsnns/NTLMClient | NTLMTest/SMBMessageParser/Models/NetworkStruct/Close/CloseResponse.cs | 2,754 | C# |
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace AntChain.SDK.REALPERSON.Models
{
/**
* Model for initing client
*/
public class Config : TeaModel {
/// <summary>
/// accesskey id
/// </summary>
[NameInMap("accessKeyId")]
[Validation(Required=false)]
public string AccessKeyId { get; set; }
/// <summary>
/// accesskey secret
/// </summary>
[NameInMap("accessKeySecret")]
[Validation(Required=false)]
public string AccessKeySecret { get; set; }
/// <summary>
/// security token
/// </summary>
[NameInMap("securityToken")]
[Validation(Required=false)]
public string SecurityToken { get; set; }
/// <summary>
/// http protocol
/// </summary>
[NameInMap("protocol")]
[Validation(Required=false)]
public string Protocol { get; set; }
/// <summary>
/// read timeout
/// </summary>
[NameInMap("readTimeout")]
[Validation(Required=false)]
public int? ReadTimeout { get; set; }
/// <summary>
/// connect timeout
/// </summary>
[NameInMap("connectTimeout")]
[Validation(Required=false)]
public int? ConnectTimeout { get; set; }
/// <summary>
/// http proxy
/// </summary>
[NameInMap("httpProxy")]
[Validation(Required=false)]
public string HttpProxy { get; set; }
/// <summary>
/// https proxy
/// </summary>
[NameInMap("httpsProxy")]
[Validation(Required=false)]
public string HttpsProxy { get; set; }
/// <summary>
/// endpoint
/// </summary>
[NameInMap("endpoint")]
[Validation(Required=false)]
public string Endpoint { get; set; }
/// <summary>
/// proxy white list
/// </summary>
[NameInMap("noProxy")]
[Validation(Required=false)]
public string NoProxy { get; set; }
/// <summary>
/// max idle conns
/// </summary>
[NameInMap("maxIdleConns")]
[Validation(Required=false)]
public int? MaxIdleConns { get; set; }
/// <summary>
/// user agent
/// </summary>
[NameInMap("userAgent")]
[Validation(Required=false)]
public string UserAgent { get; set; }
/// <summary>
/// socks5 proxy
/// </summary>
[NameInMap("socks5Proxy")]
[Validation(Required=false)]
public string Socks5Proxy { get; set; }
/// <summary>
/// socks5 network
/// </summary>
[NameInMap("socks5NetWork")]
[Validation(Required=false)]
public string Socks5NetWork { get; set; }
/// <summary>
/// 长链接最大空闲时长
/// </summary>
[NameInMap("maxIdleTimeMillis")]
[Validation(Required=false)]
public int? MaxIdleTimeMillis { get; set; }
/// <summary>
/// 长链接最大连接时长
/// </summary>
[NameInMap("keepAliveDurationMillis")]
[Validation(Required=false)]
public int? KeepAliveDurationMillis { get; set; }
/// <summary>
/// 最大连接数(长链接最大总数)
/// </summary>
[NameInMap("maxRequests")]
[Validation(Required=false)]
public int? MaxRequests { get; set; }
/// <summary>
/// 每个目标主机的最大连接数(分主机域名的长链接最大总数
/// </summary>
[NameInMap("maxRequestsPerHost")]
[Validation(Required=false)]
public int? MaxRequestsPerHost { get; set; }
}
}
| 26.097222 | 57 | 0.524215 | [
"MIT"
] | alipay/antchain-openapi-prod-sdk | realperson/csharp/core/Models/Config.cs | 3,874 | C# |
#region License
// Copyright (c) 2014
#endregion
namespace VEF.Interfaces.Services
{
/// <summary>
/// Interface ILoggerService - used for logging in the application
/// </summary>
public interface IOutputService
{
object TBStreamWriter { get; set; }
/// <summary>
/// Gets the message which just got logged.
/// </summary>
/// <value>The message.</value>
string Message { get; }
}
} | 21.045455 | 70 | 0.583153 | [
"MIT"
] | devxkh/FrankE | Editor/VEF/VEF.XForms/Interface/Services/IOutputService.cs | 463 | C# |
// (c) Copyright Microsoft Corporation.
// This source is subject to [###LICENSE_NAME###].
// Please see [###LICENSE_LINK###] for details.
// All other rights reserved.
using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows;
using System.Windows.Markup;
namespace Microsoft.Windows.Controls
{
// NOTICE: This date time helper assumes it is working in a Gregorian calendar
// If we ever support non Gregorian calendars this class would need to be redesigned
internal static class DateTimeHelper
{
private static System.Globalization.Calendar cal = new GregorianCalendar();
public static DateTime? AddDays(DateTime time, int days)
{
try
{
return cal.AddDays(time, days);
}
catch (System.ArgumentException)
{
return null;
}
}
public static DateTime? AddMonths(DateTime time, int months)
{
try
{
return cal.AddMonths(time, months);
}
catch (System.ArgumentException)
{
return null;
}
}
public static DateTime? AddYears(DateTime time, int years)
{
try
{
return cal.AddYears(time, years);
}
catch (System.ArgumentException)
{
return null;
}
}
public static DateTime? SetYear(DateTime date, int year)
{
return DateTimeHelper.AddYears(date, year - date.Year);
}
public static DateTime? SetYearMonth(DateTime date, DateTime yearMonth)
{
DateTime? target = SetYear(date, yearMonth.Year);
if (target.HasValue)
{
target = DateTimeHelper.AddMonths(target.Value, yearMonth.Month - date.Month);
}
return target;
}
public static int CompareDays(DateTime dt1, DateTime dt2)
{
return DateTime.Compare(DiscardTime(dt1).Value, DiscardTime(dt2).Value);
}
public static int CompareYearMonth(DateTime dt1, DateTime dt2)
{
return ((dt1.Year - dt2.Year) * 12) + (dt1.Month - dt2.Month);
}
public static int DecadeOfDate(DateTime date)
{
return date.Year - (date.Year % 10);
}
public static DateTime DiscardDayTime(DateTime d)
{
return new DateTime(d.Year, d.Month, 1, 0, 0, 0);
}
public static DateTime? DiscardTime(DateTime? d)
{
if (d == null)
{
return null;
}
return d.Value.Date;
}
public static int EndOfDecade(DateTime date)
{
return DecadeOfDate(date) + 9;
}
public static DateTimeFormatInfo GetCurrentDateFormat()
{
return GetDateFormat(CultureInfo.CurrentCulture);
}
internal static CultureInfo GetCulture(FrameworkElement element)
{
CultureInfo culture;
if (DependencyPropertyHelper.GetValueSource(element, FrameworkElement.LanguageProperty).BaseValueSource != BaseValueSource.Default)
{
culture = GetCultureInfo(element);
}
else
{
culture = CultureInfo.CurrentCulture;
}
return culture;
}
// ------------------------------------------------------------------
// Retrieve CultureInfo property from specified element.
// ------------------------------------------------------------------
internal static CultureInfo GetCultureInfo(DependencyObject element)
{
XmlLanguage language = (XmlLanguage)element.GetValue(FrameworkElement.LanguageProperty);
try
{
return language.GetSpecificCulture();
}
catch (InvalidOperationException)
{
// We default to en-US if no part of the language tag is recognized.
return CultureInfo.ReadOnly(new CultureInfo("en-us", false));
}
}
internal static DateTimeFormatInfo GetDateFormat(CultureInfo culture)
{
if (culture.Calendar is GregorianCalendar)
{
return culture.DateTimeFormat;
}
else
{
GregorianCalendar foundCal = null;
DateTimeFormatInfo dtfi = null;
foreach (System.Globalization.Calendar cal in culture.OptionalCalendars)
{
if (cal is GregorianCalendar)
{
// Return the first Gregorian calendar with CalendarType == Localized
// Otherwise return the first Gregorian calendar
if (foundCal == null)
{
foundCal = cal as GregorianCalendar;
}
if (((GregorianCalendar)cal).CalendarType == GregorianCalendarTypes.Localized)
{
foundCal = cal as GregorianCalendar;
break;
}
}
}
if (foundCal == null)
{
// if there are no GregorianCalendars in the OptionalCalendars list, use the invariant dtfi
dtfi = ((CultureInfo)CultureInfo.InvariantCulture.Clone()).DateTimeFormat;
dtfi.Calendar = new GregorianCalendar();
}
else
{
dtfi = ((CultureInfo)culture.Clone()).DateTimeFormat;
dtfi.Calendar = foundCal;
}
return dtfi;
}
}
// returns if the date is included in the range
public static bool InRange(DateTime date, CalendarDateRange range)
{
return InRange(date, range.Start, range.End);
}
// returns if the date is included in the range
public static bool InRange(DateTime date, DateTime start, DateTime end)
{
Debug.Assert(DateTime.Compare(start, end) < 1);
if (CompareDays(date, start) > -1 && CompareDays(date, end) < 1)
{
return true;
}
return false;
}
public static string ToDayString(DateTime? date, CultureInfo culture)
{
string result = string.Empty;
DateTimeFormatInfo format = GetDateFormat(culture);
if (date.HasValue && format != null)
{
result = date.Value.Day.ToString(format);
}
return result;
}
public static string ToDecadeRangeString(int decade, CultureInfo culture)
{
string result = string.Empty;
DateTimeFormatInfo format = culture.DateTimeFormat;
if (format != null)
{
int decadeEnd = decade + 9;
result = decade.ToString(format) + "-" + decadeEnd.ToString(format);
}
return result;
}
public static string ToYearMonthPatternString(DateTime? date, CultureInfo culture)
{
string result = string.Empty;
DateTimeFormatInfo format = GetDateFormat(culture);
if (date.HasValue && format != null)
{
result = date.Value.ToString(format.YearMonthPattern, format);
}
return result;
}
public static string ToYearString(DateTime? date, CultureInfo culture)
{
string result = string.Empty;
DateTimeFormatInfo format = GetDateFormat(culture);
if (date.HasValue && format != null)
{
result = date.Value.Year.ToString(format);
}
return result;
}
public static string ToAbbreviatedMonthString(DateTime? date, CultureInfo culture)
{
string result = string.Empty;
DateTimeFormatInfo format = GetDateFormat(culture);
if (date.HasValue && format != null)
{
string[] monthNames = format.AbbreviatedMonthNames;
if (monthNames != null && monthNames.Length > 0)
{
result = monthNames[(date.Value.Month - 1) % monthNames.Length];
}
}
return result;
}
public static string ToLongDateString(DateTime? date, CultureInfo culture)
{
string result = string.Empty;
DateTimeFormatInfo format = GetDateFormat(culture);
if (date.HasValue && format != null)
{
result = date.Value.Date.ToString(format.LongDatePattern, format);
}
return result;
}
}
} | 31.547945 | 143 | 0.513569 | [
"MIT"
] | danielhidalgojunior/zrageadminpanel | WpfToolkit/Calendar/Microsoft/Windows/Controls/DateTimeHelper.cs | 9,214 | C# |
// Copyright 2007-2010 The Apache Software Foundation.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Tests.Serialization
{
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using Context;
using Magnum.TestFramework;
using MassTransit.Serialization;
using MassTransit.Services.Subscriptions.Messages;
using Messages;
using NUnit.Framework;
public abstract class GivenASimpleMessage<TSerializer> where TSerializer : IMessageSerializer, new()
{
public PingMessage Message { get; private set; }
[SetUp]
public void SetUp()
{
Message = new PingMessage();
}
[Test]
public void ShouldWork()
{
byte[] serializedMessageData;
var serializer = new TSerializer();
using (var output = new MemoryStream())
{
serializer.Serialize(output, new SendContext<PingMessage>(Message));
serializedMessageData = output.ToArray();
Trace.WriteLine(Encoding.UTF8.GetString(serializedMessageData));
}
using (var input = new MemoryStream(serializedMessageData))
{
var receiveContext = ReceiveContext.FromBodyStream(input);
serializer.Deserialize(receiveContext);
IConsumeContext<PingMessage> context;
receiveContext.TryGetContext<PingMessage>(out context).ShouldBeTrue();
context.ShouldNotBeNull();
context.Message.ShouldEqual(Message);
}
}
}
[TestFixture]
public class WhenUsingTheXmlOnSimpleMessage :
GivenASimpleMessage<XmlMessageSerializer>
{
}
[TestFixture]
public class WhenUsingTheBinaryOnSimpleMessage :
GivenASimpleMessage<BinaryMessageSerializer>
{
}
[TestFixture]
public class WhenUsingJsonOnSimpleMessage :
GivenASimpleMessage<JsonMessageSerializer>
{
}
[TestFixture]
public class WhenUsingBsonOnSimpleMessage :
GivenASimpleMessage<BsonMessageSerializer>
{
}
} | 29.319149 | 105 | 0.642235 | [
"Apache-2.0"
] | claycephas/MassTransit | src/MassTransit.Tests/Serialization/GivenASimpleMessage.cs | 2,756 | C# |
#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
#endif
using XLua;
using System.Collections.Generic;
namespace XLua.CSObjectWrap
{
using Utils = XLua.Utils;
public class XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapPathfindingAstarWorkItemWrapWrapWrapWrapWrap
{
public static void __Register(RealStatePtr L)
{
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
System.Type type = typeof(XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapPathfindingAstarWorkItemWrapWrapWrapWrap);
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
Utils.EndObjectRegister(type, L, translator, null, null,
null, null, null);
Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
Utils.RegisterFunc(L, Utils.CLS_IDX, "__Register", _m___Register_xlua_st_);
Utils.EndClassRegister(type, L, translator);
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int __CreateInstance(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
if(LuaAPI.lua_gettop(L) == 1)
{
XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapPathfindingAstarWorkItemWrapWrapWrapWrap gen_ret = new XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapPathfindingAstarWorkItemWrapWrapWrapWrap();
translator.Push(L, gen_ret);
return 1;
}
}
catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
return LuaAPI.luaL_error(L, "invalid arguments to XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapPathfindingAstarWorkItemWrapWrapWrapWrap constructor!");
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m___Register_xlua_st_(RealStatePtr L)
{
try {
{
System.IntPtr _L = LuaAPI.lua_touserdata(L, 1);
XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapPathfindingAstarWorkItemWrapWrapWrapWrap.__Register( _L );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
}
}
| 27.118182 | 235 | 0.614147 | [
"MIT"
] | zxsean/DCET | Unity/Assets/Model/XLua/Gen/XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapPathfindingAstarWorkItemWrapWrapWrapWrapWrap.cs | 2,985 | C# |
using System;
using System.Collections.Concurrent;
using System.Text;
using Microsoft.Extensions.DependencyInjection;
using OpenIddict.Abstractions;
using OrchardCore.OpenId.YesSql.Models;
using OrchardCore.OpenId.YesSql.Stores;
namespace OrchardCore.OpenId.YesSql.Resolvers
{
/// <inheritdoc/>
public class OpenIdApplicationStoreResolver : IOpenIddictApplicationStoreResolver
{
private readonly TypeResolutionCache _cache;
private readonly IServiceProvider _provider;
public OpenIdApplicationStoreResolver(TypeResolutionCache cache, IServiceProvider provider)
{
_cache = cache;
_provider = provider;
}
/// <inheritdoc/>
public IOpenIddictApplicationStore<TApplication> Get<TApplication>() where TApplication : class
{
var store = _provider.GetService<IOpenIddictApplicationStore<TApplication>>();
if (store != null)
{
return store;
}
var type = _cache.GetOrAdd(typeof(TApplication), key =>
{
if (!typeof(OpenIdApplication).IsAssignableFrom(key))
{
throw new InvalidOperationException(new StringBuilder()
.AppendLine("The specified application type is not compatible with the YesSql stores.")
.Append("When enabling the YesSql stores, make sure you use the built-in 'OpenIdApplication' ")
.Append("entity (from the 'OrchardCore.OpenId.Core' package) or a custom entity ")
.Append("that inherits from the 'OpenIdApplication' entity.")
.ToString());
}
return typeof(OpenIdApplicationStore<>).MakeGenericType(key);
});
return (IOpenIddictApplicationStore<TApplication>)_provider.GetRequiredService(type);
}
// Note: OrchardCore YesSql resolvers are registered as scoped dependencies as their inner
// service provider must be able to resolve scoped services (typically, the store they return).
// To avoid having to declare a static type resolution cache, a special cache service is used
// here and registered as a singleton dependency so that its content persists beyond the scope.
public class TypeResolutionCache : ConcurrentDictionary<Type, Type> { }
}
}
| 42.666667 | 119 | 0.649671 | [
"BSD-3-Clause"
] | 1051324354/OrchardCore | src/OrchardCore/OrchardCore.OpenId.Core/YesSql/Resolvers/OpenIdApplicationStoreResolver.cs | 2,432 | C# |
// <auto-generated />
using System;
using EventCloud.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EventCloud.Migrations
{
[DbContext(typeof(EventCloudDbContext))]
partial class EventCloudDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.1-servicing-10028")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Abp.Application.Editions.Edition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("AbpEditions");
});
modelBuilder.Entity("Abp.Application.Features.FeatureSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.ToTable("AbpFeatures");
b.HasDiscriminator<string>("Discriminator").HasValue("FeatureSetting");
});
modelBuilder.Entity("Abp.Auditing.AuditLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BrowserInfo")
.HasMaxLength(512);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<string>("CustomData")
.HasMaxLength(2000);
b.Property<string>("Exception")
.HasMaxLength(2000);
b.Property<int>("ExecutionDuration");
b.Property<DateTime>("ExecutionTime");
b.Property<int?>("ImpersonatorTenantId");
b.Property<long?>("ImpersonatorUserId");
b.Property<string>("MethodName")
.HasMaxLength(256);
b.Property<string>("Parameters")
.HasMaxLength(1024);
b.Property<string>("ReturnValue");
b.Property<string>("ServiceName")
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "ExecutionDuration");
b.HasIndex("TenantId", "ExecutionTime");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpAuditLogs");
});
modelBuilder.Entity("Abp.Authorization.PermissionSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<bool>("IsGranted");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpPermissions");
b.HasDiscriminator<string>("Discriminator").HasValue("PermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasMaxLength(256);
b.Property<string>("ClaimValue");
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("TenantId", "ClaimType");
b.ToTable("AbpRoleClaims");
});
modelBuilder.Entity("Abp.Authorization.Users.UserAccount", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("EmailAddress")
.HasMaxLength(256);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.Property<long?>("UserLinkId");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("EmailAddress");
b.HasIndex("UserName");
b.HasIndex("TenantId", "EmailAddress");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "UserName");
b.ToTable("AbpUserAccounts");
});
modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasMaxLength(256);
b.Property<string>("ClaimValue");
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "ClaimType");
b.ToTable("AbpUserClaims");
});
modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("LoginProvider")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "LoginProvider", "ProviderKey");
b.ToTable("AbpUserLogins");
});
modelBuilder.Entity("Abp.Authorization.Users.UserLoginAttempt", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BrowserInfo")
.HasMaxLength(512);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<byte>("Result");
b.Property<string>("TenancyName")
.HasMaxLength(64);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.Property<string>("UserNameOrEmailAddress")
.HasMaxLength(255);
b.HasKey("Id");
b.HasIndex("UserId", "TenantId");
b.HasIndex("TenancyName", "UserNameOrEmailAddress", "Result");
b.ToTable("AbpUserLoginAttempts");
});
modelBuilder.Entity("Abp.Authorization.Users.UserOrganizationUnit", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<bool>("IsDeleted");
b.Property<long>("OrganizationUnitId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "OrganizationUnitId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserOrganizationUnits");
});
modelBuilder.Entity("Abp.Authorization.Users.UserRole", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "RoleId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserRoles");
});
modelBuilder.Entity("Abp.Authorization.Users.UserToken", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("ExpireDate");
b.Property<string>("LoginProvider")
.HasMaxLength(128);
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.Property<string>("Value")
.HasMaxLength(512);
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Abp.BackgroundJobs.BackgroundJobInfo", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<bool>("IsAbandoned");
b.Property<string>("JobArgs")
.IsRequired()
.HasMaxLength(1048576);
b.Property<string>("JobType")
.IsRequired()
.HasMaxLength(512);
b.Property<DateTime?>("LastTryTime");
b.Property<DateTime>("NextTryTime");
b.Property<byte>("Priority");
b.Property<short>("TryCount");
b.HasKey("Id");
b.HasIndex("IsAbandoned", "NextTryTime");
b.ToTable("AbpBackgroundJobs");
});
modelBuilder.Entity("Abp.Configuration.Setting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.Property<string>("Value")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Abp.EntityHistory.EntityChange", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("ChangeTime");
b.Property<byte>("ChangeType");
b.Property<long>("EntityChangeSetId");
b.Property<string>("EntityId")
.HasMaxLength(48);
b.Property<string>("EntityTypeFullName")
.HasMaxLength(192);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("EntityChangeSetId");
b.HasIndex("EntityTypeFullName", "EntityId");
b.ToTable("AbpEntityChanges");
});
modelBuilder.Entity("Abp.EntityHistory.EntityChangeSet", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("BrowserInfo")
.HasMaxLength(512);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<string>("ExtensionData");
b.Property<int?>("ImpersonatorTenantId");
b.Property<long?>("ImpersonatorUserId");
b.Property<string>("Reason")
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "CreationTime");
b.HasIndex("TenantId", "Reason");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpEntityChangeSets");
});
modelBuilder.Entity("Abp.EntityHistory.EntityPropertyChange", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<long>("EntityChangeId");
b.Property<string>("NewValue")
.HasMaxLength(512);
b.Property<string>("OriginalValue")
.HasMaxLength(512);
b.Property<string>("PropertyName")
.HasMaxLength(96);
b.Property<string>("PropertyTypeFullName")
.HasMaxLength(192);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("EntityChangeId");
b.ToTable("AbpEntityPropertyChanges");
});
modelBuilder.Entity("Abp.Localization.ApplicationLanguage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("Icon")
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<bool>("IsDisabled");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(10);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpLanguages");
});
modelBuilder.Entity("Abp.Localization.ApplicationLanguageText", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("LanguageName")
.IsRequired()
.HasMaxLength(10);
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Source")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(67108864);
b.HasKey("Id");
b.HasIndex("TenantId", "Source", "LanguageName", "Key");
b.ToTable("AbpLanguageTexts");
});
modelBuilder.Entity("Abp.Notifications.NotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Data")
.HasMaxLength(1048576);
b.Property<string>("DataTypeName")
.HasMaxLength(512);
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("ExcludedUserIds")
.HasMaxLength(131072);
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(96);
b.Property<byte>("Severity");
b.Property<string>("TenantIds")
.HasMaxLength(131072);
b.Property<string>("UserIds")
.HasMaxLength(131072);
b.HasKey("Id");
b.ToTable("AbpNotifications");
});
modelBuilder.Entity("Abp.Notifications.NotificationSubscriptionInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("NotificationName")
.HasMaxLength(96);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("NotificationName", "EntityTypeName", "EntityId", "UserId");
b.HasIndex("TenantId", "NotificationName", "EntityTypeName", "EntityId", "UserId");
b.ToTable("AbpNotificationSubscriptions");
});
modelBuilder.Entity("Abp.Notifications.TenantNotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Data")
.HasMaxLength(1048576);
b.Property<string>("DataTypeName")
.HasMaxLength(512);
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(96);
b.Property<byte>("Severity");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("AbpTenantNotifications");
});
modelBuilder.Entity("Abp.Notifications.UserNotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<int>("State");
b.Property<int?>("TenantId");
b.Property<Guid>("TenantNotificationId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId", "State", "CreationTime");
b.ToTable("AbpUserNotifications");
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(95);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<long?>("ParentId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("TenantId", "Code");
b.ToTable("AbpOrganizationUnits");
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnitRole", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<bool>("IsDeleted");
b.Property<long>("OrganizationUnitId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "OrganizationUnitId");
b.HasIndex("TenantId", "RoleId");
b.ToTable("AbpOrganizationUnitRoles");
});
modelBuilder.Entity("EventCloud.Authorization.Roles.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(5000);
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<bool>("IsDefault");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsStatic");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(32);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenantId", "NormalizedName");
b.ToTable("AbpRoles");
});
modelBuilder.Entity("EventCloud.Authorization.Users.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("AccessFailedCount");
b.Property<string>("AuthenticationSource")
.HasMaxLength(64);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("EmailAddress")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("EmailConfirmationCode")
.HasMaxLength(328);
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsEmailConfirmed");
b.Property<bool>("IsLockoutEnabled");
b.Property<bool>("IsPhoneNumberConfirmed");
b.Property<bool>("IsTwoFactorEnabled");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<DateTime?>("LockoutEndDateUtc");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("NormalizedEmailAddress")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("PasswordResetCode")
.HasMaxLength(328);
b.Property<string>("PhoneNumber")
.HasMaxLength(32);
b.Property<string>("SecurityStamp")
.HasMaxLength(128);
b.Property<string>("Surname")
.IsRequired()
.HasMaxLength(64);
b.Property<int?>("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenantId", "NormalizedEmailAddress");
b.HasIndex("TenantId", "NormalizedUserName");
b.ToTable("AbpUsers");
});
modelBuilder.Entity("EventCloud.Events.Event", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<DateTime>("Date");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(2048);
b.Property<bool>("IsCancelled");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<int>("MaxRegistrationCount");
b.Property<int>("TenantId");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(128);
b.HasKey("Id");
b.ToTable("AppEvents");
});
modelBuilder.Entity("EventCloud.Events.EventRegistration", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<Guid>("EventId");
b.Property<int>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("EventId");
b.HasIndex("UserId");
b.ToTable("AppEventRegistrations");
});
modelBuilder.Entity("EventCloud.MultiTenancy.Tenant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ConnectionString")
.HasMaxLength(1024);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<int?>("EditionId");
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("TenancyName")
.IsRequired()
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("EditionId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenancyName");
b.ToTable("AbpTenants");
});
modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b =>
{
b.HasBaseType("Abp.Application.Features.FeatureSetting");
b.Property<int>("EditionId");
b.HasIndex("EditionId", "Name");
b.ToTable("AbpFeatures");
b.HasDiscriminator().HasValue("EditionFeatureSetting");
});
modelBuilder.Entity("Abp.MultiTenancy.TenantFeatureSetting", b =>
{
b.HasBaseType("Abp.Application.Features.FeatureSetting");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpFeatures");
b.HasDiscriminator().HasValue("TenantFeatureSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b =>
{
b.HasBaseType("Abp.Authorization.PermissionSetting");
b.Property<int>("RoleId");
b.HasIndex("RoleId");
b.ToTable("AbpPermissions");
b.HasDiscriminator().HasValue("RolePermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b =>
{
b.HasBaseType("Abp.Authorization.PermissionSetting");
b.Property<long>("UserId");
b.HasIndex("UserId");
b.ToTable("AbpPermissions");
b.HasDiscriminator().HasValue("UserPermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b =>
{
b.HasOne("EventCloud.Authorization.Roles.Role")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b =>
{
b.HasOne("EventCloud.Authorization.Users.User")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b =>
{
b.HasOne("EventCloud.Authorization.Users.User")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserRole", b =>
{
b.HasOne("EventCloud.Authorization.Users.User")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserToken", b =>
{
b.HasOne("EventCloud.Authorization.Users.User")
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Configuration.Setting", b =>
{
b.HasOne("EventCloud.Authorization.Users.User")
.WithMany("Settings")
.HasForeignKey("UserId");
});
modelBuilder.Entity("Abp.EntityHistory.EntityChange", b =>
{
b.HasOne("Abp.EntityHistory.EntityChangeSet")
.WithMany("EntityChanges")
.HasForeignKey("EntityChangeSetId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.EntityHistory.EntityPropertyChange", b =>
{
b.HasOne("Abp.EntityHistory.EntityChange")
.WithMany("PropertyChanges")
.HasForeignKey("EntityChangeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b =>
{
b.HasOne("Abp.Organizations.OrganizationUnit", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
});
modelBuilder.Entity("EventCloud.Authorization.Roles.Role", b =>
{
b.HasOne("EventCloud.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("EventCloud.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("EventCloud.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("EventCloud.Authorization.Users.User", b =>
{
b.HasOne("EventCloud.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("EventCloud.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("EventCloud.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("EventCloud.Events.EventRegistration", b =>
{
b.HasOne("EventCloud.Events.Event", "Event")
.WithMany("Registrations")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("EventCloud.Authorization.Users.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("EventCloud.MultiTenancy.Tenant", b =>
{
b.HasOne("EventCloud.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("EventCloud.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("Abp.Application.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId");
b.HasOne("EventCloud.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b =>
{
b.HasOne("Abp.Application.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b =>
{
b.HasOne("EventCloud.Authorization.Roles.Role")
.WithMany("Permissions")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b =>
{
b.HasOne("EventCloud.Authorization.Users.User")
.WithMany("Permissions")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
| 33.518764 | 125 | 0.459233 | [
"MIT"
] | andreeko28/eventcloud | aspnet-core-angular/aspnet-core/src/EventCloud.EntityFrameworkCore/Migrations/EventCloudDbContextModelSnapshot.cs | 45,554 | C# |
using UnityEngine;
namespace traVRsal.SDK
{
public class JointHelper : MonoBehaviour
{
public bool lockXPosition = true;
public bool lockYPosition = true;
public bool lockZPosition = true;
public bool lockXRotation = true;
public bool lockYRotation = true;
public bool lockZRotation = true;
private Vector3 _initialPosition;
private Vector3 _initialRotation;
private void Start()
{
_initialPosition = transform.localPosition;
_initialRotation = transform.localEulerAngles;
}
private void LockPosition()
{
if (lockXPosition || lockYPosition || lockZPosition)
{
Vector3 currentPosition = transform.localPosition;
transform.localPosition = new Vector3(lockXPosition ? _initialPosition.x : currentPosition.x, lockYPosition ? _initialPosition.y : currentPosition.y, lockZPosition ? _initialPosition.z : currentPosition.z);
}
if (lockXRotation || lockYRotation || lockZRotation)
{
Vector3 currentRotation = transform.localEulerAngles;
transform.localEulerAngles = new Vector3(lockXRotation ? _initialRotation.x : currentRotation.x, lockYRotation ? _initialRotation.y : currentRotation.y, lockZRotation ? _initialRotation.z : currentRotation.z);
}
}
private void LateUpdate()
{
LockPosition();
}
private void FixedUpdate()
{
LockPosition();
}
}
} | 32.734694 | 225 | 0.619701 | [
"MIT"
] | WetzoldStudios/traVRsal-sdk | Runtime/Logic/Interactions/JointHelper.cs | 1,606 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace Microsoft.Azure.SignalR.Management
{
/// <summary>
/// A builder for configuring <see cref="IServiceManager"/> instances.
/// </summary>
public class ServiceManagerBuilder : IServiceManagerBuilder
{
private readonly ServiceManagerOptions _options = new ServiceManagerOptions();
/// <summary>
/// Configures the <see cref="IServiceManager"/> instances.
/// </summary>
/// <param name="configure">A callback to configure the <see cref="IServiceManager"/>.</param>
/// <returns>The same instance of the <see cref="ServiceManagerBuilder"/> for chaining.</returns>
public ServiceManagerBuilder WithOptions(Action<ServiceManagerOptions> configure)
{
configure?.Invoke(_options);
return this;
}
/// <summary>
/// Builds <see cref="IServiceManager"/> instances.
/// </summary>
/// <returns>The instance of the <see cref="IServiceManager"/>.</returns>
public IServiceManager Build()
{
_options.ValidateOptions();
return new ServiceManager(_options);
}
}
} | 36.833333 | 105 | 0.638009 | [
"MIT"
] | KKhurin/azure-signalr | src/Microsoft.Azure.SignalR.Management/ServiceManagerBuilder.cs | 1,328 | C# |
using LiNGS.Common.Network;
using LiNGS.Server.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LiNGS.Server.Aggregator
{
internal class BufferedNetworkMessage
{
public NetworkMessage Message { get; set; }
public DateTime FirstMessageDataTime { get; set; }
public DateTime LastMessageDataTime { get; set; }
public TimeSpan MaxBufferTime { get; set; }
public NetworkClient Destination { get; set; }
public BufferedNetworkMessage() : this(TimeSpan.FromMilliseconds(10))
{
}
/// <summary>
/// Creates a new instance of <see cref="BufferedNetworkMessage"/>
/// </summary>
/// <param name="timeout">The maximum time that the message can be hold in the buffer</param>
public BufferedNetworkMessage(TimeSpan timeout)
{
this.Message = new NetworkMessage(LiNGS.Common.Network.NetworkMessage.MessageType.Data);
this.MaxBufferTime = timeout;
this.FirstMessageDataTime = DateTime.Now;
}
public void AppendMessageData(MessageData data)
{
this.Message.Data.Add(data);
this.LastMessageDataTime = DateTime.Now;
}
public void AppendMessageData(List<MessageData> data)
{
this.Message.Data.AddRange(data);
this.LastMessageDataTime = DateTime.Now;
}
}
}
| 31.085106 | 101 | 0.639973 | [
"MIT"
] | valterc/lings | LiNGSServer/Aggregator/BufferedNetworkMessage.cs | 1,463 | C# |
using Affecto.Mapping.AutoMapper;
using AutoMapper;
namespace Affecto.AuditTrail.Querying.Mapping
{
internal class AuditTrailFilterMapper : OneWayMapper<Model.AuditTrailFilter, Store.Model.AuditTrailFilter>
{
protected override void ConfigureMaps()
{
Mapper.CreateMap<Model.AuditTrailDateFilterOperator, Store.Model.AuditTrailDateFilterOperator>();
Mapper.CreateMap<Model.AuditTrailDateFilterParameter, Store.Model.AuditTrailDateFilterParameter>();
Mapper.CreateMap<Model.AuditTrailTextFilterOperator, Store.Model.AuditTrailTextFilterOperator>();
Mapper.CreateMap<Model.AuditTrailTextFilterParameter, Store.Model.AuditTrailTextFilterParameter>();
Mapper.CreateMap<Model.AuditTrailSortDirection, Store.Model.AuditTrailSortDirection>();
Mapper.CreateMap<Model.AuditTrailSortField, Store.Model.AuditTrailSortField>();
Mapper.CreateMap<Model.AuditTrailSortParameter, Store.Model.AuditTrailSortParameter>();
Mapper.CreateMap<Model.AuditTrailFilter, Store.Model.AuditTrailFilter>();
}
}
} | 48.652174 | 111 | 0.753351 | [
"MIT"
] | affecto/dotnet-AuditTrailService | AuditTrail.Querying/Mapping/AuditTrailFilterMapper.cs | 1,121 | C# |
//
// This file was auto-generated using the ChilliConnect SDK Generator.
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Tag Games Ltd
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using SdkCore;
namespace ChilliConnect
{
/// <summary>
/// <para>A container for all information that will be sent to the server during a
/// Get Inventory api call.</para>
///
/// <para>This is immutable after construction and is therefore thread safe.</para>
/// </summary>
public sealed class GetInventoryRequest : IImmediateServerRequest
{
/// <summary>
/// The url the request will be sent to.
/// </summary>
public string Url { get; private set; }
/// <summary>
/// The HTTP request method that should be used.
/// </summary>
public HttpRequestMethod HttpRequestMethod { get; private set; }
/// <summary>
/// A valid session ConnectAccessToken obtained through one of the login endpoints.
/// </summary>
public string ConnectAccessToken { get; private set; }
/// <summary>
/// Initialises a new instance of the request with the given properties.
/// </summary>
///
/// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param>
public GetInventoryRequest(string connectAccessToken)
{
ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null.");
ConnectAccessToken = connectAccessToken;
Url = "https://connect.chilliconnect.com/2.0/economy/inventory/get";
HttpRequestMethod = HttpRequestMethod.Post;
}
/// <summary>
/// Serialises all header properties. The output will be a dictionary containing
/// the extra header key-value pairs in addition the standard headers sent with
/// all server requests. Will return an empty dictionary if there are no headers.
/// </summary>
///
/// <returns>The header key-value pairs.</returns>
public IDictionary<string, string> SerialiseHeaders()
{
var dictionary = new Dictionary<string, string>();
// Connect Access Token
dictionary.Add("Connect-Access-Token", ConnectAccessToken.ToString());
return dictionary;
}
/// <summary>
/// Serialises all body properties. The output will be a dictionary containing the
/// body of the request in a form that can easily be converted to Json. Will return
/// an empty dictionary if there is no body.
/// </summary>
///
/// <returns>The body Json in dictionary form.</returns>
public IDictionary<string, object> SerialiseBody()
{
return new Dictionary<string, object>();
}
}
}
| 36.456311 | 126 | 0.717443 | [
"MIT"
] | ChilliConnect/Samples | UnitySamples/CharacterGacha/Assets/ChilliConnect/GeneratedSource/Requests/GetInventoryRequest.cs | 3,755 | C# |
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;
using SFA.DAS.ApplyService.Application.Apply;
using SFA.DAS.ApplyService.Application.Apply.Assessor;
using SFA.DAS.ApplyService.Application.Apply.Gateway;
using SFA.DAS.ApplyService.Domain.Entities;
using SFA.DAS.ApplyService.Domain.Interfaces;
namespace SFA.DAS.ApplyService.Application.UnitTests.Handlers.UpdateGatewayReviewStatusAsClarificationHandlerTests
{
[TestFixture]
public class UpdateGatewayReviewStatusAsClarificationHandlerTests
{
private Mock<IApplyRepository> _repository;
private Mock<IGatewayRepository> _gatewayRepository;
private UpdateGatewayReviewStatusAsClarificationHandler _handler;
[SetUp]
public void TestSetup()
{
_repository = new Mock<IApplyRepository>();
_gatewayRepository = new Mock<IGatewayRepository>();
_handler = new UpdateGatewayReviewStatusAsClarificationHandler(_repository.Object, _gatewayRepository.Object);
_gatewayRepository.Setup(x => x.UpdateGatewayReviewStatusAndComment(It.IsAny<Guid>(), It.IsAny<ApplyData>(),
It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).ReturnsAsync(true);
}
[Test]
public async Task UpdateReviewStatus_to_clarification_where_no_application_returns_false()
{
var applicationId = Guid.NewGuid();
var userId = "4fs7f-userId-7gfhh";
var userName = "joe";
_repository.Setup(x => x.GetApplication(applicationId)).ReturnsAsync((Domain.Entities.Apply)null);
var result = await _handler.Handle(new UpdateGatewayReviewStatusAsClarificationRequest(applicationId, userId, userName), new CancellationToken());
Assert.IsFalse(result);
_gatewayRepository.Verify(x => x.UpdateGatewayReviewStatusAndComment(applicationId,It.IsAny<Domain.Entities.ApplyData>(), It.IsAny<string>(), It.IsAny<string>(),It.IsAny<string>()), Times.Never);
}
[Test]
public async Task UpdateReviewStatus_to_clarification_returns_true()
{
var applicationId = Guid.NewGuid();
var userId = "4fs7f-userId-7gfhh";
var userName = "janet";
_repository.Setup(x => x.GetApplication(applicationId)).ReturnsAsync( new Domain.Entities.Apply {ApplicationId = applicationId});
var result = await _handler.Handle(new UpdateGatewayReviewStatusAsClarificationRequest(applicationId, userId, userName), new CancellationToken());
Assert.IsTrue(result);
_gatewayRepository.Verify(x => x.UpdateGatewayReviewStatusAndComment(applicationId, It.IsAny<Domain.Entities.ApplyData>(), GatewayReviewStatus.ClarificationSent, userId, userName), Times.Once);
}
}
}
| 45.920635 | 207 | 0.71552 | [
"MIT"
] | uk-gov-mirror/SkillsFundingAgency.das-apply-service | src/SFA.DAS.ApplyService.Application.UnitTests/Handlers/UpdateGatewayReviewStatusAsClarificationHandlerTests/UpdateGatewayReviewStatusAsClarificationHandlerTests.cs | 2,895 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 組件的一般資訊是由下列的屬性集控制。
// 變更這些屬性的值即可修改組件的相關
// 資訊。
[assembly: AssemblyTitle("TryReadAPI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TryReadAPI")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 將 ComVisible 設為 false 可對 COM 元件隱藏
// 組件中的類型。若必須從 COM 存取此組件中的類型,
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("f319cbd9-8aa2-431c-ac8c-9c5eeb2446d7")]
// 組件的版本資訊由下列四個值所組成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂
//
// 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
// 設為預設,如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 25.648649 | 56 | 0.713383 | [
"MIT"
] | theMoudou/DataBindControls | DataBindControls/TryReadAPI/Properties/AssemblyInfo.cs | 1,274 | C# |
namespace MiniUML.View.Views.ResizeAdorner.Thumbs
{
using System.Windows.Controls.Primitives;
/// <summary>
/// A move thumb can be used to move a shape on the canvas.
/// (This thumb is not yet used in this implementation)
///
/// The resize adorner view design is baed on
/// http://www.codeproject.com/Articles/22952/WPF-Diagram-Designer-Part-1
/// </summary>
public class MoveThumb : Thumb
{
////private DesignerItem designerItem;
//// private DesignerCanvas designerCanvas;
public MoveThumb()
{
//// DragStarted += new DragStartedEventHandler(this.MoveThumb_DragStarted);
//// DragDelta += new DragDeltaEventHandler(this.MoveThumb_DragDelta);
}
/****
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e)
{
this.designerItem = DataContext as DesignerItem;
if (this.designerItem != null)
{
this.designerCanvas = VisualTreeHelper.GetParent(this.designerItem) as DesignerCanvas;
}
}
****/
/****
private void MoveThumb_DragDelta(object sender, DragDeltaEventArgs e)
{
if (this.designerItem != null && this.designerCanvas != null && this.designerItem.IsSelected)
{
double minLeft = double.MaxValue;
double minTop = double.MaxValue;
foreach (DesignerItem item in this.designerCanvas.SelectedItems)
{
minLeft = Math.Min(Canvas.GetLeft(item), minLeft);
minTop = Math.Min(Canvas.GetTop(item), minTop);
}
double deltaHorizontal = Math.Max(-minLeft, e.HorizontalChange);
double deltaVertical = Math.Max(-minTop, e.VerticalChange);
foreach (DesignerItem item in this.designerCanvas.SelectedItems)
{
Canvas.SetLeft(item, Canvas.GetLeft(item) + deltaHorizontal);
Canvas.SetTop(item, Canvas.GetTop(item) + deltaVertical);
}
this.designerCanvas.InvalidateMeasure();
e.Handled = true;
}
}
*/
}
}
| 30.461538 | 99 | 0.658586 | [
"MIT"
] | Dirkster99/Edi | MiniUML/MiniUML.View/Views/ResizeAdorner/Thumbs/MoveThumb.cs | 1,982 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Threading;
using Xunit;
namespace System.Diagnostics.Tests
{
public static class StopwatchTests
{
private static readonly ManualResetEvent s_sleepEvent = new ManualResetEvent(false);
[Fact]
public static void GetTimestamp()
{
long ts1 = Stopwatch.GetTimestamp();
Sleep();
long ts2 = Stopwatch.GetTimestamp();
Assert.NotEqual(ts1, ts2);
}
[Fact]
public static void ConstructStartAndStop()
{
Stopwatch watch = new Stopwatch();
Assert.False(watch.IsRunning);
Assert.Equal(TimeSpan.Zero, watch.Elapsed);
Assert.Equal(0, watch.ElapsedTicks);
Assert.Equal(0, watch.ElapsedMilliseconds);
watch.Start();
Assert.True(watch.IsRunning);
Sleep();
Assert.True(watch.Elapsed > TimeSpan.Zero);
watch.Stop();
Assert.False(watch.IsRunning);
var e1 = watch.Elapsed;
Sleep();
var e2 = watch.Elapsed;
Assert.Equal(e1, e2);
Assert.Equal((long)e1.TotalMilliseconds, watch.ElapsedMilliseconds);
var t1 = watch.ElapsedTicks;
Sleep();
var t2 = watch.ElapsedTicks;
Assert.Equal(t1, t2);
}
[Fact]
public static void StartNewAndReset()
{
Stopwatch watch = Stopwatch.StartNew();
Assert.True(watch.IsRunning);
watch.Start(); // should be no-op
Assert.True(watch.IsRunning);
Sleep();
Assert.True(watch.Elapsed > TimeSpan.Zero);
watch.Reset();
Assert.False(watch.IsRunning);
Assert.Equal(TimeSpan.Zero, watch.Elapsed);
Assert.Equal(0, watch.ElapsedTicks);
Assert.Equal(0, watch.ElapsedMilliseconds);
}
[Fact]
public static void StartNewAndRestart()
{
Stopwatch watch = Stopwatch.StartNew();
Assert.True(watch.IsRunning);
Sleep(10);
TimeSpan elapsedSinceStart = watch.Elapsed;
Assert.True(elapsedSinceStart > TimeSpan.Zero);
const int MaxAttempts = 5; // The comparison below could fail if we get very unlucky with when the thread gets preempted
int attempt = 0;
while (true)
{
watch.Restart();
Assert.True(watch.IsRunning);
try
{
Assert.True(watch.Elapsed < elapsedSinceStart);
}
catch
{
if (++attempt < MaxAttempts) continue;
throw;
}
break;
}
}
[OuterLoop("Sleeps for relatively long periods of time")]
[Fact]
public static void ElapsedMilliseconds_WithinExpectedWindow()
{
const int AllowedTries = 30;
const int SleepTime = 1000;
const double WindowFactor = 2;
var results = new List<long>();
var sw = new Stopwatch();
for (int trial = 0; trial < AllowedTries; trial++)
{
sw.Restart();
Thread.Sleep(SleepTime);
sw.Stop();
if (sw.ElapsedMilliseconds >= (SleepTime / WindowFactor) &&
sw.ElapsedMilliseconds <= (SleepTime * WindowFactor))
{
return;
}
results.Add(sw.ElapsedMilliseconds);
}
Assert.True(false, $"All {AllowedTries} fell outside of {WindowFactor} window of {SleepTime} sleep time: {string.Join(", ", results)}");
}
private static void Sleep(int milliseconds = 1)
{
s_sleepEvent.WaitOne(milliseconds);
}
}
}
| 31.704545 | 148 | 0.532855 | [
"MIT"
] | 06needhamt/runtime | src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs | 4,185 | C# |
// MIT License
//
// Copyright (c) 2009-2017 Luca Piccioni
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// This file is automatically generated
#pragma warning disable 649, 1572, 1573
// ReSharper disable RedundantUsingDirective
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using Khronos;
// ReSharper disable CheckNamespace
// ReSharper disable InconsistentNaming
// ReSharper disable JoinDeclarationAndInitializer
namespace OpenGL
{
public partial class Egl
{
/// <summary>
/// [EGL] Value of EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT symbol.
/// </summary>
[RequiredByFeature("EGL_EXT_create_context_robustness")]
public const int CONTEXT_OPENGL_ROBUST_ACCESS_EXT = 0x30BF;
/// <summary>
/// [EGL] Value of EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT symbol.
/// </summary>
[RequiredByFeature("EGL_EXT_create_context_robustness")]
public const int CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT = 0x3138;
}
}
| 34.316667 | 81 | 0.771734 | [
"MIT"
] | GiantBlargg/OpenGL.Net | OpenGL.Net/EXT/Egl.EXT_create_context_robustness.cs | 2,059 | C# |
namespace RTCV.UI
{
partial class UI_CanvasForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pnScale = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// pnScale
//
this.pnScale.BackColor = System.Drawing.Color.Gray;
this.pnScale.Location = new System.Drawing.Point(15, 15);
this.pnScale.Name = "pnScale";
this.pnScale.Size = new System.Drawing.Size(50, 50);
this.pnScale.TabIndex = 5;
this.pnScale.Tag = "color:normal";
//
// UI_CanvasForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.ClientSize = new System.Drawing.Size(591, 425);
this.Controls.Add(this.pnScale);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "UI_CanvasForm";
this.Tag = "color:dark";
this.Text = "UI_CanvasForm";
this.Load += new System.EventHandler(this.UI_CanvasForm_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel pnScale;
}
} | 36.274194 | 128 | 0.553579 | [
"MIT"
] | fossabot/RTCV | Source/Tests/GlitchHarvester/UI_CanvasForm.Designer.cs | 2,251 | C# |
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TransportSystem.Data.Dbcontexts;
namespace TransportSystem.Data.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20210610083510_initt")]
partial class initt
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.6")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.Bus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<decimal>("Amount")
.HasColumnType("decimal(18,2)");
b.Property<int>("AvailableSeat")
.HasColumnType("int");
b.Property<string>("BusName")
.HasColumnType("nvarchar(max)");
b.Property<int>("DepartingTerminalId")
.HasColumnType("int");
b.Property<DateTime>("DepartureTime")
.HasColumnType("datetime2");
b.Property<bool>("IsAcAvailable")
.HasColumnType("bit");
b.Property<bool>("IsPickUpAvailable")
.HasColumnType("bit");
b.Property<int>("TerminalID")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DepartingTerminalId");
b.HasIndex("TerminalID");
b.ToTable("Buses");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.DepartingTerminal", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("DepartingTerminalName")
.HasColumnType("nvarchar(max)");
b.Property<int>("TerminalId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("TerminalId");
b.ToTable("DepartingTerminal");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.Seat", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("BusId")
.HasColumnType("int");
b.Property<bool>("IsSeatAvailable")
.HasColumnType("bit");
b.Property<int>("SeatNumber")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BusId");
b.ToTable("Seats");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.Terminal", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("TerminalName")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Terminals");
});
modelBuilder.Entity("TransportSystem.Data.Entities.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("TransportSystem.Data.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("TransportSystem.Data.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("TransportSystem.Data.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("TransportSystem.Data.Entities.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("TransportSystem.Data.DbModels.Bus", b =>
{
b.HasOne("TransportSystem.Data.DbModels.DepartingTerminal", "DepartingTerminal")
.WithMany("Bus")
.HasForeignKey("DepartingTerminalId")
.OnDelete(DeleteBehavior.ClientCascade)
.IsRequired();
b.HasOne("TransportSystem.Data.DbModels.Terminal", "Terminal")
.WithMany("Bus")
.HasForeignKey("TerminalID")
.OnDelete(DeleteBehavior.ClientCascade)
.IsRequired();
b.Navigation("DepartingTerminal");
b.Navigation("Terminal");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.DepartingTerminal", b =>
{
b.HasOne("TransportSystem.Data.DbModels.Terminal", "Terminal")
.WithMany("DepartingTerminals")
.HasForeignKey("TerminalId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Terminal");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.Seat", b =>
{
b.HasOne("TransportSystem.Data.DbModels.Bus", "Bus")
.WithMany("Seat")
.HasForeignKey("BusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Bus");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.Bus", b =>
{
b.Navigation("Seat");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.DepartingTerminal", b =>
{
b.Navigation("Bus");
});
modelBuilder.Entity("TransportSystem.Data.DbModels.Terminal", b =>
{
b.Navigation("Bus");
b.Navigation("DepartingTerminals");
});
#pragma warning restore 612, 618
}
}
}
| 37.346512 | 125 | 0.466654 | [
"MIT"
] | richardnwonah/TransportSystem.App | TransportSystem.Data/Migrations/20210610083510_initt.Designer.cs | 16,061 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.Devices.Usb
{
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
#endif
public partial class UsbDeviceClass
{
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public byte? SubclassCode
{
get
{
throw new global::System.NotImplementedException("The member byte? UsbDeviceClass.SubclassCode is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Usb.UsbDeviceClass", "byte? UsbDeviceClass.SubclassCode");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public byte? ProtocolCode
{
get
{
throw new global::System.NotImplementedException("The member byte? UsbDeviceClass.ProtocolCode is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Usb.UsbDeviceClass", "byte? UsbDeviceClass.ProtocolCode");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public byte ClassCode
{
get
{
throw new global::System.NotImplementedException("The member byte UsbDeviceClass.ClassCode is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Usb.UsbDeviceClass", "byte UsbDeviceClass.ClassCode");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public UsbDeviceClass()
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Usb.UsbDeviceClass", "UsbDeviceClass.UsbDeviceClass()");
}
#endif
// Forced skipping of method Windows.Devices.Usb.UsbDeviceClass.UsbDeviceClass()
// Forced skipping of method Windows.Devices.Usb.UsbDeviceClass.ClassCode.get
// Forced skipping of method Windows.Devices.Usb.UsbDeviceClass.ClassCode.set
// Forced skipping of method Windows.Devices.Usb.UsbDeviceClass.SubclassCode.get
// Forced skipping of method Windows.Devices.Usb.UsbDeviceClass.SubclassCode.set
// Forced skipping of method Windows.Devices.Usb.UsbDeviceClass.ProtocolCode.get
// Forced skipping of method Windows.Devices.Usb.UsbDeviceClass.ProtocolCode.set
}
}
| 35.838235 | 153 | 0.748461 | [
"Apache-2.0"
] | nv-ksavaria/Uno | src/Uno.UWP/Generated/3.0.0.0/Windows.Devices.Usb/UsbDeviceClass.cs | 2,437 | C# |
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Redis.V20180412.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class DescribeAutoBackupConfigRequest : AbstractModel
{
/// <summary>
/// 实例ID
/// </summary>
[JsonProperty("InstanceId")]
public string InstanceId{ get; set; }
/// <summary>
/// For internal usage only. DO NOT USE IT.
/// </summary>
internal override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamSimple(map, prefix + "InstanceId", this.InstanceId);
}
}
}
| 29.75 | 83 | 0.662338 | [
"Apache-2.0"
] | ImEdisonJiang/tencentcloud-sdk-dotnet | TencentCloud/Redis/V20180412/Models/DescribeAutoBackupConfigRequest.cs | 1,313 | C# |
using Perpetuum.Accounting.Characters;
using Perpetuum.Data;
using Perpetuum.Host.Requests;
using Perpetuum.Services.Channels;
namespace Perpetuum.RequestHandlers.Channels
{
public class ChannelKick : IRequestHandler
{
private readonly IChannelManager _channelManager;
public ChannelKick(IChannelManager channelManager)
{
_channelManager = channelManager;
}
public void HandleRequest(IRequest request)
{
using (var scope = Db.CreateTransaction())
{
var channelName = request.Data.GetOrDefault<string>(k.channel);
var member = Character.Get(request.Data.GetOrDefault<int>(k.memberID));
var ban = request.Data.GetOrDefault<int>(k.ban) > 0;
var message = request.Data.GetOrDefault<string>(k.message);
var character = request.Session.Character;
_channelManager.KickOrBan(channelName, character, member, message, ban);
Message.Builder.FromRequest(request).WithOk().Send();
scope.Complete();
}
}
}
} | 34.088235 | 88 | 0.618637 | [
"MIT"
] | LoyalServant/PerpetuumServerCore | Perpetuum.RequestHandlers/Channels/ChannelKick.cs | 1,161 | C# |
//Write a program that compares two text files line by line and prints the number of lines that are the same and the number of lines that are different.
//Assume the files have equal number of lines.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace _04.CompareTextFiles
{
class Program
{
static void Main()
{
using (StreamReader firstReader = new StreamReader(@"..\..\firstFile.txt"))
{
using (StreamReader secondReader = new StreamReader(@"..\..\secondFile.txt"))
{
string firstFileLine = firstReader.ReadLine();
string secondFileLine = secondReader.ReadLine();
int same = 0;
int different = 0;
while (firstFileLine != null)
{
if (firstFileLine.CompareTo(secondFileLine) == 0)
{
same++;
}
else
{
different++;
}
firstFileLine = firstReader.ReadLine();
secondFileLine = secondReader.ReadLine();
}
Console.WriteLine("The number of same lines is: {0}", same);
Console.WriteLine("The number of different lines is: {0}", different);
}
}
}
}
}
| 33.041667 | 153 | 0.485498 | [
"MIT"
] | ztodorova/Telerik-Academy | C#-part2/TextFiles/04.CompareTextFiles/Program.cs | 1,588 | C# |
namespace ZazasCleaningService.Web.ViewModels.Votes
{
public class VoteResponseViewModel
{
public int VotesCount { get; set; }
}
}
| 19 | 52 | 0.684211 | [
"MIT"
] | TihomirIvanovIvanov/ZazasCleaningService | ZazasCleaningService/Web/ZazasCleaningService.Web.ViewModels/Votes/VoteResponseViewModel.cs | 154 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Net;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Text;
using Microsoft.Protocols.TestManager.Detector;
using Microsoft.Protocols.TestTools;
using Microsoft.Protocols.TestTools.StackSdk;
using Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpbcgr;
using Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpedyc;
using Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpemt;
using Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpeudp;
using System.Runtime.InteropServices;
namespace Microsoft.Protocols.TestManager.RDPServerPlugin
{
public class RdpbcgrTestData
{
public const string DefaultX224ConnectReqCookie = "Cookie: mstshash=IDENTIFIER\r\n";
public const string DefaultX224ConnectReqRoutingToken = "TestRoutingToken\r\n";
public const uint DefaultClientBuild = 0x0A28;
public const flags_Values DefaultClientInfoPduFlags = flags_Values.INFO_MOUSE
| flags_Values.INFO_DISABLECTRLALTDEL
| flags_Values.INFO_UNICODE
| flags_Values.INFO_MAXIMIZESHELL
| flags_Values.INFO_ENABLEWINDOWSKEY
| flags_Values.INFO_FORCE_ENCRYPTED_CS_PDU
| flags_Values.INFO_LOGONNOTIFY
| flags_Values.INFO_LOGONERRORS;
public const int ClientRandomSize = 32;
public const ushort RN_USER_REQUESTED = 3;
public static byte[] GetDefaultX224ConnectReqCorrelationId()
{
byte[] returnArray = new byte[16];
new System.Random().NextBytes(returnArray);
if (returnArray[0] == 0x00 || returnArray[0] == 0xF4)
{
returnArray[0] = 0x01;
}
for (int i = 1; i < returnArray.Length; i++)
{
if (returnArray[i] == 0x0D)
{
returnArray[i] = 0x01;
}
}
return returnArray;
}
}
public class RDPDetector : IDisposable
{
#region Variables
private DetectionInfo detectInfo;
private List<StackPacket> receiveBuffer = null;
private RdpbcgrClient rdpbcgrClient = null;
private RdpedycClient rdpedycClient = null;
private string[] SVCNames;
private int defaultPort = 3389;
private string clientName;
private IPAddress clientAddress;
private EncryptedProtocol encryptedProtocol;
private requestedProtocols_Values requestedProtocol;
private TimeSpan timeout;
#endregion Variables
#region Received Packets
Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response connectResponsePdu = null;
#endregion Received Packets
private const string SVCNAME_RDPEDYC = "drdynvc";
private const string DYVNAME_RDPEDYC = "Microsoft::Windows::RDS::Geometry::v08.01";
#region Constructor
public RDPDetector(DetectionInfo detectInfo)
{
this.detectInfo = detectInfo;
}
#endregion Constructor
#region Methods
/// <summary>
/// Establish a RDP connection to detect RDP feature
/// </summary>
/// <returns>Return true if detection succeeded.</returns>
public bool DetectRDPFeature(Configs config)
{
try
{
DetectorUtil.WriteLog("Establish RDP connection with SUT...");
Initialize(config);
ConnectRDPServer();
bool status = EstablishRDPConnection(
config, requestedProtocol, SVCNames,
CompressionType.PACKET_COMPR_TYPE_NONE,
false,
true,
false,
false,
false,
true,
true);
if (!status)
{
DetectorUtil.WriteLog("Failed", false, LogStyle.StepFailed);
return false;
}
DetectorUtil.WriteLog("Passed", false, LogStyle.StepPassed);
CheckSupportedFeatures();
CheckSupportedProtocols();
SetRdpVersion(config);
}
catch (Exception e)
{
DetectorUtil.WriteLog("Exception occured when establishing RDP connection: " + e.Message);
DetectorUtil.WriteLog("" + e.StackTrace);
if (e.InnerException != null)
{
DetectorUtil.WriteLog("**" + e.InnerException.Message);
DetectorUtil.WriteLog("**" + e.InnerException.StackTrace);
}
DetectorUtil.WriteLog("Failed", false, LogStyle.StepFailed);
return false;
}
// Disconnect
ClientInitiatedDisconnect();
Disconnect();
DetectorUtil.WriteLog("Passed", false, LogStyle.StepPassed);
return true;
}
private void Initialize(Configs config)
{
receiveBuffer = new List<StackPacket>();
SVCNames = new string[] { SVCNAME_RDPEDYC };
clientName = config.ClientName;
LoadConfig();
int port;
rdpbcgrClient = new RdpbcgrClient(
config.ServerDomain,
config.ServerName,
config.ServerUserName,
config.ServerUserPassword,
clientAddress.ToString(),
Int32.TryParse(config.ServerPort, out port) ? port : defaultPort
);
}
private bool LoadConfig()
{
if (!IPAddress.TryParse(clientName, out clientAddress))
{
clientAddress = Dns.GetHostEntry(clientName).AddressList.First();
}
bool isNegotiationBased = true;
string negotiation = DetectorUtil.GetPropertyValue("RDP.Security.Negotiation");
if (negotiation.Equals("true", StringComparison.CurrentCultureIgnoreCase))
{
isNegotiationBased = true;
}
else if (negotiation.Equals("false", StringComparison.CurrentCultureIgnoreCase))
{
isNegotiationBased = false;
}
else
{
throw new Exception(
String.Format("The property value \"{0}\" is invalid or not present in RDP.Security.Negotiation in ptfconfig", negotiation));
}
string protocol = DetectorUtil.GetPropertyValue("RDP.Security.Protocol");
if (protocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase))
{
requestedProtocol = requestedProtocols_Values.PROTOCOL_SSL_FLAG;
if (!isNegotiationBased)
{
throw new Exception(
String.Format("When TLS is used as the security protocol, RDP.Security.Negotiation must be true;" +
"actually RDP.Security.Negotiation is set to \"{0}\".", negotiation));
}
encryptedProtocol = EncryptedProtocol.NegotiationTls;
}
else if (protocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase))
{
requestedProtocol = requestedProtocols_Values.PROTOCOL_HYBRID_FLAG;
if (isNegotiationBased)
{
encryptedProtocol = EncryptedProtocol.NegotiationCredSsp;
}
else
{
encryptedProtocol = EncryptedProtocol.NegotiationTls;
}
}
else if (protocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase))
{
requestedProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG;
encryptedProtocol = EncryptedProtocol.Rdp;
}
else
{
throw new Exception(
String.Format("The property value \"{0}\" is invalid or not present in RDP.Security.Protocol in ptfconfig", protocol));
}
string strWaitTime = DetectorUtil.GetPropertyValue("WaitTime");
if (strWaitTime != null)
{
int waitTime = Int32.Parse(strWaitTime);
timeout = new TimeSpan(0, 0, waitTime);
}
else
{
timeout = new TimeSpan(0, 0, 10);
}
return true;
}
private void ConnectRDPServer()
{
rdpbcgrClient.Connect(encryptedProtocol);
}
private void Disconnect()
{
rdpbcgrClient.Disconnect();
}
private bool EstablishRDPConnection(
Configs config,
requestedProtocols_Values requestedProtocols,
string[] SVCNames,
CompressionType highestCompressionTypeSupported,
bool isReconnect = false,
bool autoLogon = false,
bool supportEGFX = false,
bool supportAutoDetect = false,
bool supportHeartbeatPDU = false,
bool supportMultitransportReliable = false,
bool supportMultitransportLossy = false,
bool supportAutoReconnect = false,
bool supportFastPathInput = false,
bool supportFastPathOutput = false,
bool supportSurfaceCommands = false,
bool supportSVCCompression = false,
bool supportRemoteFXCodec = false)
{
// Connection Initiation
SendClientX224ConnectionRequest(requestedProtocols);
Server_X_224_Connection_Confirm_Pdu connectionConfirmPdu = ExpectPacket<Server_X_224_Connection_Confirm_Pdu>(timeout);
if (connectionConfirmPdu == null)
{
return false;
}
// Basic Settings Exchange
SendClientMCSConnectInitialPDU(
SVCNames,
supportEGFX,
supportAutoDetect,
supportHeartbeatPDU,
supportMultitransportReliable,
supportMultitransportLossy,
false);
connectResponsePdu = ExpectPacket<Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response>(timeout);
if (connectResponsePdu == null)
{
return false;
}
bool serverSupportUDPFECR = false;
bool serverSupportUDPFECL = false;
if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData != null)
{
if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECR))
{
serverSupportUDPFECR = true;
}
if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECL))
{
serverSupportUDPFECL = true;
}
}
detectInfo.IsSupportRDPEMT = serverSupportUDPFECR || serverSupportUDPFECL;
// Channel Connection
SendClientMCSErectDomainRequest();
SendClientMCSAttachUserRequest();
Server_MCS_Attach_User_Confirm_Pdu userConfirmPdu = ExpectPacket<Server_MCS_Attach_User_Confirm_Pdu>(timeout);
if (userConfirmPdu == null)
{
return false;
}
ChannelJoinRequestAndConfirm();
// RDP Security Commencement
if (rdpbcgrClient.Context.ServerSelectedProtocol == (uint)selectedProtocols_Values.PROTOCOL_RDP_FLAG)
{
SendClientSecurityExchangePDU();
}
// Secure Settings Exchange
SendClientInfoPDU(config, highestCompressionTypeSupported, isReconnect, autoLogon);
// Licensing
Server_License_Error_Pdu_Valid_Client licenseErrorPdu = ExpectPacket<Server_License_Error_Pdu_Valid_Client>(timeout);
if (licenseErrorPdu == null)
{
return false;
}
// Capabilities Exchange
Server_Demand_Active_Pdu demandActivePdu = ExpectPacket<Server_Demand_Active_Pdu>(timeout);
if (demandActivePdu == null)
{
return false;
}
SendClientConfirmActivePDU(
supportAutoReconnect,
supportFastPathInput,
supportFastPathOutput,
supportSVCCompression);
// Connection Finalization
SendClientSynchronizePDU();
Server_Synchronize_Pdu syncPdu = ExpectPacket<Server_Synchronize_Pdu>(timeout);
if (syncPdu == null)
{
return false;
}
Server_Control_Pdu_Cooperate CoopControlPdu = ExpectPacket<Server_Control_Pdu_Cooperate>(timeout);
if (CoopControlPdu == null)
{
return false;
}
SendClientControlCooperatePDU();
SendClientControlRequestPDU();
Server_Control_Pdu_Granted_Control grantedControlPdu = ExpectPacket<Server_Control_Pdu_Granted_Control>(timeout);
if (grantedControlPdu == null)
{
return false;
}
SendClientFontListPDU();
Server_Font_Map_Pdu fontMapPdu = ExpectPacket<Server_Font_Map_Pdu>(timeout);
if (fontMapPdu == null)
{
return false;
}
return true;
}
private void CheckSupportedFeatures()
{
DetectorUtil.WriteLog("Check specified features support...");
detectInfo.IsSupportAutoReconnect = SupportAutoReconnect();
detectInfo.IsSupportFastPathInput = SupportFastPathInput();
// Notify the UI for detecting feature supported finished
DetectorUtil.WriteLog("Passed", false, LogStyle.StepPassed);
}
private bool SupportAutoReconnect()
{
ITsCapsSet capset = GetServerCapSet(capabilitySetType_Values.CAPSTYPE_GENERAL);
if (capset != null)
{
TS_GENERAL_CAPABILITYSET generalCap = (TS_GENERAL_CAPABILITYSET)capset;
if (generalCap.extraFlags.HasFlag(extraFlags_Values.AUTORECONNECT_SUPPORTED))
{
return true;
}
}
return false;
}
private bool SupportFastPathInput()
{
ITsCapsSet capset = GetServerCapSet(capabilitySetType_Values.CAPSTYPE_INPUT);
if (capset != null)
{
TS_INPUT_CAPABILITYSET inputCap = (TS_INPUT_CAPABILITYSET)capset;
if (inputCap.inputFlags.HasFlag(inputFlags_Values.INPUT_FLAG_FASTPATH_INPUT)
|| inputCap.inputFlags.HasFlag(inputFlags_Values.INPUT_FLAG_FASTPATH_INPUT2))
{
return true;
}
}
return false;
}
private ITsCapsSet GetServerCapSet(capabilitySetType_Values capsetType)
{
Collection<ITsCapsSet> capsets = this.rdpbcgrClient.Context.demandActivemCapabilitySets;
if (capsets != null)
{
foreach (ITsCapsSet capSet in capsets)
{
if (capSet.GetCapabilityType() == capsetType)
{
return capSet;
}
}
}
return null;
}
private void CheckSupportedProtocols()
{
// Notify the UI for detecting protocol supported finished
DetectorUtil.WriteLog("Check specified protocols support...");
bool serverSupportUDPFECR = false;
bool serverSupportUDPFECL = false;
if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData != null)
{
if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECR))
{
serverSupportUDPFECR = true;
}
if (connectResponsePdu.mcsCrsp.gccPdu.serverMultitransportChannelData.flags.HasFlag(MULTITRANSPORT_TYPE_FLAGS.TRANSPORTTYPE_UDPFECL))
{
serverSupportUDPFECL = true;
}
}
detectInfo.IsSupportRDPEMT = serverSupportUDPFECR || serverSupportUDPFECL;
if (detectInfo.IsSupportRDPEMT)
{
DetectorUtil.WriteLog("Detect RDPEMT supported");
}
else
{
DetectorUtil.WriteLog("Detect RDPEMT unsupported");
}
rdpedycClient = new RdpedycClient(rdpbcgrClient.Context, false);
try
{
DynamicVirtualChannel channel = rdpedycClient.ExpectChannel(timeout, DYVNAME_RDPEDYC, DynamicVC_TransportType.RDP_TCP);
if (channel != null)
{
detectInfo.IsSupportRDPEDYC = true;
}
rdpedycClient.CloseChannel((ushort)channel.ChannelId);
}
catch
{
detectInfo.IsSupportRDPEDYC = false;
}
if (detectInfo.IsSupportRDPEDYC)
{
DetectorUtil.WriteLog("Detect RDPEDYC supported");
}
else
{
DetectorUtil.WriteLog("Detect RDPEDYC unsupported");
}
DetectorUtil.WriteLog("Passed", false, LogStyle.StepPassed);
}
private void SetRdpVersion(Configs config)
{
DetectorUtil.WriteLog("Detect RDP version...");
config.Version = DetectorUtil.GetPropertyValue("RDP.Version");
if (connectResponsePdu.mcsCrsp.gccPdu.serverCoreData == null)
{
DetectorUtil.WriteLog("Failed", false, LogStyle.StepFailed);
DetectorUtil.WriteLog("Detect RDP version failed, serverCoreData in Server_MCS_Connect_Response_Pdu_with_GCC_Conference_Create_Response does not exist!");
}
TS_UD_SC_CORE_version_Values rdpVersion = connectResponsePdu.mcsCrsp.gccPdu.serverCoreData.version;
if (rdpVersion == TS_UD_SC_CORE_version_Values.V1)
{
config.Version = "4.0";
}
else if (rdpVersion == TS_UD_SC_CORE_version_Values.V2)
{
config.Version = "8.1";
}
else if (rdpVersion == TS_UD_SC_CORE_version_Values.V3)
{
config.Version = "10.0";
}
else if (rdpVersion == TS_UD_SC_CORE_version_Values.V4)
{
config.Version = "10.1";
}
else if (rdpVersion == TS_UD_SC_CORE_version_Values.V5)
{
config.Version = "10.2";
}
else if (rdpVersion == TS_UD_SC_CORE_version_Values.V6)
{
config.Version = "10.3";
}
else if (rdpVersion == TS_UD_SC_CORE_version_Values.V7)
{
config.Version = "10.4";
}
else if (rdpVersion == TS_UD_SC_CORE_version_Values.V8)
{
config.Version = "10.5";
}
else if (rdpVersion == TS_UD_SC_CORE_version_Values.V9)
{
config.Version = "10.6";
}
else
{
DetectorUtil.WriteLog("Failed", false, LogStyle.StepFailed);
DetectorUtil.WriteLog("Detect RDP version failed, unknown version detected!");
}
detectInfo.Version = connectResponsePdu.mcsCrsp.gccPdu.serverCoreData.version;
DetectorUtil.WriteLog("Passed", false, LogStyle.StepPassed);
DetectorUtil.WriteLog("Detect RDP version finished.");
}
private void SendClientX224ConnectionRequest(
requestedProtocols_Values requestedProtocols,
bool isRdpNegReqPresent = true,
bool isRoutingTokenPresent = false,
bool isCookiePresent = false,
bool isRdpCorrelationInfoPresent = false)
{
Client_X_224_Connection_Request_Pdu x224ConnectReqPdu = rdpbcgrClient.CreateX224ConnectionRequestPdu(requestedProtocols);
if (isRoutingTokenPresent)
{
// Present the routingToken
x224ConnectReqPdu.routingToken = ASCIIEncoding.ASCII.GetBytes(RdpbcgrTestData.DefaultX224ConnectReqRoutingToken);
x224ConnectReqPdu.tpktHeader.length += (ushort)x224ConnectReqPdu.routingToken.Length;
x224ConnectReqPdu.x224Crq.lengthIndicator += (byte)x224ConnectReqPdu.routingToken.Length;
}
if (isCookiePresent)
{
// Present the cookie
x224ConnectReqPdu.cookie = RdpbcgrTestData.DefaultX224ConnectReqCookie;
x224ConnectReqPdu.tpktHeader.length += (ushort)x224ConnectReqPdu.cookie.Length;
x224ConnectReqPdu.x224Crq.lengthIndicator += (byte)x224ConnectReqPdu.cookie.Length;
}
if (!isRdpNegReqPresent)
{
// RdpNegReq is already present, remove it if isRdpNegReqPresent is false
x224ConnectReqPdu.rdpNegData = null;
int rdpNegDataSize = sizeof(byte) + sizeof(byte) + sizeof(ushort) + sizeof(uint);
x224ConnectReqPdu.tpktHeader.length -= (ushort)rdpNegDataSize;
x224ConnectReqPdu.x224Crq.lengthIndicator -= (byte)rdpNegDataSize;
}
if (isRdpCorrelationInfoPresent)
{
// Present the RdpCorrelationInfo
x224ConnectReqPdu.rdpCorrelationInfo = new RDP_NEG_CORRELATION_INFO();
x224ConnectReqPdu.rdpCorrelationInfo.type = RDP_NEG_CORRELATION_INFO_Type.TYPE_RDP_CORRELATION_INFO;
x224ConnectReqPdu.rdpCorrelationInfo.flags = 0;
x224ConnectReqPdu.rdpCorrelationInfo.length = 36;
x224ConnectReqPdu.rdpCorrelationInfo.correlationId = RdpbcgrTestData.GetDefaultX224ConnectReqCorrelationId();
x224ConnectReqPdu.rdpCorrelationInfo.reserved = new byte[16];
x224ConnectReqPdu.tpktHeader.length += (ushort)x224ConnectReqPdu.rdpCorrelationInfo.length;
x224ConnectReqPdu.x224Crq.lengthIndicator += (byte)x224ConnectReqPdu.rdpCorrelationInfo.length;
}
rdpbcgrClient.SendPdu(x224ConnectReqPdu);
}
private void SendClientMCSConnectInitialPDU(
string[] SVCNames,
bool supportEGFX,
bool supportAutoDetect,
bool supportHeartbeatPDU,
bool supportMultitransportReliable,
bool supportMultitransportLossy,
bool isMonitorDataPresent)
{
Client_MCS_Connect_Initial_Pdu_with_GCC_Conference_Create_Request request = rdpbcgrClient.CreateMCSConnectInitialPduWithGCCConferenceCreateRequestPdu(
clientName,
RdpbcgrTestData.DefaultClientBuild,
System.Guid.NewGuid().ToString(),
encryptionMethod_Values._128BIT_ENCRYPTION_FLAG,
SVCNames,
supportMultitransportReliable,
supportMultitransportLossy,
isMonitorDataPresent);
if (supportEGFX)
{
// If support RDPEGFX, set flag: RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL in clientCoreData.earlyCapabilityFlags
request.mcsCi.gccPdu.clientCoreData.earlyCapabilityFlags.actualData |= (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL;
}
if (supportAutoDetect)
{
// If support auto-detect, set flag: RNS_UD_CS_SUPPORT_NETWORK_AUTODETECT in clientCoreData.earlyCapabilityFlags
request.mcsCi.gccPdu.clientCoreData.earlyCapabilityFlags.actualData |= (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_NETWORK_AUTODETECT;
request.mcsCi.gccPdu.clientCoreData.connnectionType = new ByteClass((byte)ConnnectionType.CONNECTION_TYPE_AUTODETECT);
}
if (supportHeartbeatPDU)
{
// If support Heartbeat PDU, set flag: RNS_UD_CS_SUPPORT_HEARTBEAT_PDU in clientCoreData.earlyCapabilityFlags
request.mcsCi.gccPdu.clientCoreData.earlyCapabilityFlags.actualData |= (ushort)earlyCapabilityFlags_Values.RNS_UD_CS_SUPPORT_HEARTBEAT_PDU;
}
rdpbcgrClient.SendPdu(request);
}
private void SendClientMCSErectDomainRequest()
{
Client_MCS_Erect_Domain_Request request = rdpbcgrClient.CreateMCSErectDomainRequestPdu();
rdpbcgrClient.SendPdu(request);
}
private void SendClientMCSAttachUserRequest()
{
Client_MCS_Attach_User_Request request = rdpbcgrClient.CreateMCSAttachUserRequestPdu();
rdpbcgrClient.SendPdu(request);
}
private void SendClientMCSChannelJoinRequest(long channelId)
{
Client_MCS_Channel_Join_Request request = rdpbcgrClient.CreateMCSChannelJoinRequestPdu(channelId);
rdpbcgrClient.SendPdu(request);
}
private void ChannelJoinRequestAndConfirm()
{
// Add all SVC ids in a List
List<long> chIdList = new List<long>();
// Add User channel
chIdList.Add(rdpbcgrClient.Context.UserChannelId);
// Add IO channel
chIdList.Add(rdpbcgrClient.Context.IOChannelId);
// Add message channel if exist
long? msgChId = rdpbcgrClient.Context.MessageChannelId;
if (msgChId != null)
{
chIdList.Add(msgChId.Value);
}
// Add the other channels from server network data
if (rdpbcgrClient.Context.VirtualChannelIdStore != null)
{
for (int i = 0; i < rdpbcgrClient.Context.VirtualChannelIdStore.Length; i++)
{
chIdList.Add((long)rdpbcgrClient.Context.VirtualChannelIdStore[i]);
}
}
// Start join request and confirm sequence
foreach (long channelId in chIdList)
{
SendClientMCSChannelJoinRequest(channelId);
Server_MCS_Channel_Join_Confirm_Pdu confirm = ExpectPacket<Server_MCS_Channel_Join_Confirm_Pdu>(timeout);
}
}
private void SendClientSecurityExchangePDU()
{
// Create random data
byte[] clientRandom = RdpbcgrUtility.GenerateRandom(RdpbcgrTestData.ClientRandomSize);
Client_Security_Exchange_Pdu exchangePdu = rdpbcgrClient.CreateSecurityExchangePdu(clientRandom);
rdpbcgrClient.SendPdu(exchangePdu);
}
private void SendClientInfoPDU(Configs config, CompressionType highestCompressionTypeSupported, bool isReconnect = false, bool autoLogon = true)
{
Client_Info_Pdu pdu = rdpbcgrClient.CreateClientInfoPdu(RdpbcgrTestData.DefaultClientInfoPduFlags, config.ServerDomain, config.ServerUserName, config.ServerUserPassword, clientAddress.ToString(), null, null, isReconnect);
if (autoLogon)
{
pdu.infoPacket.flags |= flags_Values.INFO_AUTOLOGON;
}
if (highestCompressionTypeSupported != CompressionType.PACKET_COMPR_TYPE_NONE)
{
// Set the compression flag
uint compressionFlag = ((uint)highestCompressionTypeSupported) << 9;
pdu.infoPacket.flags |= (flags_Values)((uint)pdu.infoPacket.flags | compressionFlag);
}
rdpbcgrClient.SendPdu(pdu);
}
private void SendClientConfirmActivePDU(
bool supportAutoReconnect,
bool supportFastPathInput,
bool supportFastPathOutput,
bool supportSVCCompression)
{
Collection<ITsCapsSet> caps = rdpbcgrClient.CreateCapabilitySets(
supportAutoReconnect,
supportFastPathInput,
supportFastPathOutput,
supportSVCCompression);
Client_Confirm_Active_Pdu pdu = rdpbcgrClient.CreateConfirmActivePdu(caps);
rdpbcgrClient.SendPdu(pdu);
}
private void SendClientSynchronizePDU()
{
Client_Synchronize_Pdu syncPdu = rdpbcgrClient.CreateSynchronizePdu();
rdpbcgrClient.SendPdu(syncPdu);
}
private void SendClientControlCooperatePDU()
{
Client_Control_Pdu_Cooperate controlCooperatePdu = rdpbcgrClient.CreateControlCooperatePdu();
rdpbcgrClient.SendPdu(controlCooperatePdu);
}
private void SendClientControlRequestPDU()
{
Client_Control_Pdu_Request_Control requestControlPdu = rdpbcgrClient.CreateControlRequestPdu();
rdpbcgrClient.SendPdu(requestControlPdu);
}
private void SendClientPersistentKeyListPDU()
{
Client_Persistent_Key_List_Pdu persistentKeyListPdu = rdpbcgrClient.CreatePersistentKeyListPdu();
rdpbcgrClient.SendPdu(persistentKeyListPdu);
}
private void SendClientFontListPDU()
{
Client_Font_List_Pdu fontListPdu = rdpbcgrClient.CreateFontListPdu();
rdpbcgrClient.SendPdu(fontListPdu);
}
private void ClientInitiatedDisconnect()
{
SendMCSDisconnectProviderUltimatumPDU();
}
private void SendMCSDisconnectProviderUltimatumPDU()
{
MCS_Disconnect_Provider_Ultimatum_Pdu ultimatumPdu = rdpbcgrClient.CreateMCSDisconnectProviderUltimatumPdu(RdpbcgrTestData.RN_USER_REQUESTED);
rdpbcgrClient.SendPdu(ultimatumPdu);
}
/// <summary>
/// Dispose
/// </summary>
public void Dispose()
{
if (rdpbcgrClient != null)
{
rdpbcgrClient.Dispose();
rdpbcgrClient = null;
}
}
private T ExpectPacket<T>(TimeSpan timeout) where T : StackPacket
{
T receivedPacket = null;
// Firstly, go through the receive buffer, if have packet with type T, return it.
if (receiveBuffer.Count > 0)
{
lock (receiveBuffer)
{
for (int i = 0; i < receiveBuffer.Count; i++)
{
if (receiveBuffer[i] is T)
{
receivedPacket = receiveBuffer[i] as T;
receiveBuffer.RemoveAt(i);
return receivedPacket;
}
}
}
}
// Then, expect new packet from lower level transport
DateTime endTime = DateTime.Now + timeout;
while (DateTime.Now < endTime)
{
timeout = endTime - DateTime.Now;
if (timeout.TotalMilliseconds > 0)
{
StackPacket packet = null;
try
{
packet = this.ExpectPdu(timeout);
}
catch (TimeoutException)
{
packet = null;
}
if (packet != null)
{
if (packet is T)
{
return packet as T;
}
else if (packet is ErrorPdu)
{
throw new Exception(string.Format(((ErrorPdu)packet).ErrorMessage));
}
else
{
// If the type of received packet is not T, add it into receive buffer
lock (receiveBuffer)
{
receiveBuffer.Add(packet);
}
}
}
}
}
return null;
}
private StackPacket ExpectPdu(TimeSpan timeout)
{
return rdpbcgrClient.ExpectPdu(timeout);
}
#endregion Methods
}
}
| 39.578885 | 233 | 0.577581 | [
"MIT"
] | MinLiSH/WindowsProtocolTestSuites | ProtocolTestManager/Plugins/RDPServerPlugin/RDPServerPlugin/Detector/RDPDetector.cs | 33,365 | C# |
namespace Brewery.ProjectTool.Commands;
internal interface IToolCommand
{
void Run();
} | 15.5 | 40 | 0.763441 | [
"MIT"
] | Valax321/Brewery | src/ProjectTool/Commands/IToolCommand.cs | 95 | C# |
singleton Material(OccStone_01_OccStone001DIF)
{
mapTo = "OccStone001DIF";
diffuseMap[0] = "Occ_Stone_001_DIF";
normalMap[0] = "Occ_Stone_001_NRM";
specular[0] = "0.9 0.9 0.9 1";
specularPower[0] = "10";
translucentBlendOp = "None";
};
| 23.181818 | 46 | 0.670588 | [
"CC0-1.0"
] | Torque3D-Games-Demos/T3D_Ron_Demos | data/FPSGameplay/cave/art/shapes/Cave_Rocks/OccStone_01/materials.cs | 255 | C# |
public sealed class TestAttribute : JCMG.EntitasRedux.ContextAttribute
{
public TestAttribute() : base("Test") { }
}
| 23.6 | 70 | 0.754237 | [
"MIT"
] | MaxShwachko/entitas-redux-modified | Unity/Assets/JCMG/EntitasRedux/Scripts/Editor/Tests/Generated/Test/TestAttribute.cs | 118 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Foundation.Metadata.Annotations;
namespace Foundation.Metadata.Conventions
{
public class RelationshipDiscoveryConvention : IEntityConvention
{
public const string NAVIGATION_CANDIDATES_ANNOTATION_NAME = "RelationshipDiscoveryConvention:NavigationCandidates";
public const string AMBIGUOUS_NAVIGATIONS_ANNOTATION_NAME = "RelationshipDiscoveryConvention:AmbiguousNavigations";
public Entity Apply(Entity entity)
{
if (entity.IsShadowEntity) return entity;
if (entity.FindAnnotation(NAVIGATION_CANDIDATES_ANNOTATION_NAME) == null)
{
var model = entity.Model;
var discoveredEntities = new List<Entity>();
var unvisitedEntities = new Stack<Entity>();
unvisitedEntities.Push(entity);
while (unvisitedEntities.Count > 0)
{
var nextEntity = unvisitedEntities.Pop();
discoveredEntities.Add(nextEntity);
var navigationCandidates = GetNavigationCandidates(nextEntity).Reverse();
foreach (var candidateTuple in navigationCandidates)
{
var targetClrType = candidateTuple.Value;
if (model.FindEntity(targetClrType) != null /* || nextEntity.IsIgnored(candidateTuple.Key.Name, ConfigurationSource.Convention) */ )
{
continue;
}
var candidateTargetEntity = model.AddEntity(targetClrType, runConventions: false);
if (candidateTargetEntity != null)
{
unvisitedEntities.Push(candidateTargetEntity);
}
}
}
for (var i = 1; i < discoveredEntities.Count; i++)
{
model.ConventionDispatcher.OnEntityAdded(discoveredEntities[i]);
}
}
return DiscoverRelationships(entity);
}
private Entity DiscoverRelationships(Entity entity)
{
if (entity.IsShadowEntity /* || entity.Model.IsIgnored(entity.ClrType) */ )
{
return entity;
}
var relationshipCandidates = FindRelationshipCandidates(entity);
relationshipCandidates = RemoveIncompatibleRelationships(relationshipCandidates, entity);
CreateRelationships(relationshipCandidates, entity);
return entity;
}
private void CreateRelationships(IReadOnlyList<RelationshipCandidate> relationshipCandidates, Entity entity)
{
foreach (var relationshipCandidate in relationshipCandidates)
{
var navigationProperty = relationshipCandidate.NavigationProperties.SingleOrDefault();
var inverseProperty = relationshipCandidate.InverseProperties.SingleOrDefault();
if (inverseProperty == null)
{
entity.AddManyToManyRelationship(relationshipCandidate.TargetEntity, navigationProperty);
}
else
{
entity.AddManyToManyRelationship(relationshipCandidate.TargetEntity, navigationProperty, inverseProperty);
}
}
}
private IReadOnlyList<RelationshipCandidate> FindRelationshipCandidates(Entity entity)
{
var relationshipCandidates = new Dictionary<Type, RelationshipCandidate>();
var navigationCandidates = GetNavigationCandidates(entity);
foreach (var candidateTuple in navigationCandidates)
{
var navigationPropertyInfo = candidateTuple.Key;
var targetClrType = candidateTuple.Value;
//if (entity.IsIgnored(navigationPropertyInfo.Name))
//{
// continue;
//}
var candidateTargetEntity = entity.Model.FindEntity(targetClrType);
if (candidateTargetEntity == null)
{
continue;
}
RelationshipCandidate existingCandidate;
if (relationshipCandidates.TryGetValue(targetClrType, out existingCandidate))
{
if (candidateTargetEntity != entity || !existingCandidate.InverseProperties.Contains(navigationPropertyInfo))
{
existingCandidate.NavigationProperties.Add(navigationPropertyInfo);
}
continue;
}
var navigations = new HashSet<PropertyInfo> { navigationPropertyInfo };
var inverseCandidates = GetNavigationCandidates(candidateTargetEntity);
var inverseNavigationCandidates = new HashSet<PropertyInfo>();
foreach (var inverseCandidateTuple in inverseCandidates)
{
var inversePropertyInfo = inverseCandidateTuple.Key;
var inverseTargetType = inverseCandidateTuple.Value;
if (inverseTargetType != entity.ClrType || navigationPropertyInfo == inversePropertyInfo /* || candidateTargetEntity.IsIgnored(inversePropertyInfo.Name) */ )
{
continue;
}
inverseNavigationCandidates.Add(inversePropertyInfo);
}
relationshipCandidates[targetClrType] = new RelationshipCandidate(candidateTargetEntity, navigations, inverseNavigationCandidates);
}
return relationshipCandidates.Values.ToList();
}
private IReadOnlyList<RelationshipCandidate> RemoveIncompatibleRelationships(IReadOnlyList<RelationshipCandidate> relationshipCandidates, Entity entity)
{
var filteredRelationshipCandidates = new List<RelationshipCandidate>();
foreach (var relationshipCandidate in relationshipCandidates)
{
var targetEntity = relationshipCandidate.TargetEntity;
int nbNavigationProperties = relationshipCandidate.NavigationProperties.Count;
var revisitNavigations = true;
while (revisitNavigations)
{
revisitNavigations = false;
foreach (var navigationProperty in relationshipCandidate.NavigationProperties)
{
var existingNavigation = entity.FindNavigation(navigationProperty.Name);
if (existingNavigation != null)
{
relationshipCandidate.NavigationProperties.Remove(navigationProperty);
revisitNavigations = true;
break;
}
var navigationPropertyAttribute = navigationProperty.GetCustomAttribute<RelationshipAttribute>();
var compatibleInverseProperties = new List<PropertyInfo>();
var revisitInverses = true;
while (revisitInverses)
{
revisitInverses = false;
foreach (var inversePropertyInfo in relationshipCandidate.InverseProperties)
{
if (navigationPropertyAttribute != null &&
navigationPropertyAttribute.InverseProperty.Equals(inversePropertyInfo.Name, StringComparison.OrdinalIgnoreCase))
{
compatibleInverseProperties.Add(inversePropertyInfo);
relationshipCandidate.InverseProperties.Remove(inversePropertyInfo);
revisitInverses = true;
break;
}
var inversePropertyAttribute = inversePropertyInfo.GetCustomAttribute<RelationshipAttribute>();
if (inversePropertyAttribute != null &&
inversePropertyAttribute.InverseProperty.Equals(navigationProperty.Name, StringComparison.OrdinalIgnoreCase))
{
compatibleInverseProperties.Add(inversePropertyInfo);
relationshipCandidate.InverseProperties.Remove(inversePropertyInfo);
revisitInverses = true;
break;
}
if (relationshipCandidate.NavigationProperties.Count == 1 && relationshipCandidate.InverseProperties.Count == 1)
{
compatibleInverseProperties.Add(inversePropertyInfo);
relationshipCandidate.InverseProperties.Remove(inversePropertyInfo);
revisitInverses = true;
break;
}
}
}
if (compatibleInverseProperties.Count == 0 &&
((navigationPropertyAttribute != null && string.IsNullOrWhiteSpace(navigationPropertyAttribute.InverseProperty)) || nbNavigationProperties == 1))
{
relationshipCandidate.NavigationProperties.Remove(navigationProperty);
filteredRelationshipCandidates.Add(new RelationshipCandidate(targetEntity, new HashSet<PropertyInfo> { navigationProperty }, new HashSet<PropertyInfo>()));
if ((relationshipCandidate.TargetEntity == entity) && (relationshipCandidate.InverseProperties.Count > 0))
{
var nextSelfRefCandidate = relationshipCandidate.InverseProperties.First();
relationshipCandidate.NavigationProperties.Add(nextSelfRefCandidate);
relationshipCandidate.InverseProperties.Remove(nextSelfRefCandidate);
}
revisitNavigations = true;
break;
}
if (compatibleInverseProperties.Count == 1)
{
var inverseProperty = compatibleInverseProperties[0];
relationshipCandidate.NavigationProperties.Remove(navigationProperty);
relationshipCandidate.InverseProperties.Remove(inverseProperty);
filteredRelationshipCandidates.Add(new RelationshipCandidate(targetEntity, new HashSet<PropertyInfo> { navigationProperty }, new HashSet<PropertyInfo> { inverseProperty }));
if ((relationshipCandidate.TargetEntity == entity) && (relationshipCandidate.InverseProperties.Count > 0))
{
var nextSelfRefCandidate = relationshipCandidate.InverseProperties.First();
relationshipCandidate.NavigationProperties.Add(nextSelfRefCandidate);
relationshipCandidate.InverseProperties.Remove(nextSelfRefCandidate);
}
revisitNavigations = true;
break;
}
}
}
if (relationshipCandidate.NavigationProperties.Count > 0)
{
AddAmbiguousNavigations(entity, relationshipCandidate.NavigationProperties);
}
}
return filteredRelationshipCandidates;
}
private SortedDictionary<PropertyInfo, Type> GetNavigationCandidates(Entity entity)
{
var navigationCandidates = entity.FindAnnotation(NAVIGATION_CANDIDATES_ANNOTATION_NAME)?.Value as SortedDictionary<PropertyInfo, Type>;
if (navigationCandidates == null)
{
navigationCandidates = new SortedDictionary<PropertyInfo, Type>(PropertyInfoNameComparer.Instance);
foreach (var propertyInfo in entity.ClrType.GetRuntimeProperties().OrderBy(p => p.Name))
{
var targetType = propertyInfo.FindCandidateNavigationPropertyType();
if (targetType != null)
{
navigationCandidates[propertyInfo] = targetType;
}
}
SetNavigationCandidates(entity, navigationCandidates);
}
return navigationCandidates;
}
private void SetNavigationCandidates(Entity entity, SortedDictionary<PropertyInfo, Type> navigationCandidates)
=> entity.SetAnnotation(NAVIGATION_CANDIDATES_ANNOTATION_NAME, navigationCandidates);
private SortedDictionary<PropertyInfo, Type> GetAmbigousNavigations(Entity entity) => entity.FindAnnotation(AMBIGUOUS_NAVIGATIONS_ANNOTATION_NAME)?.Value as SortedDictionary<PropertyInfo, Type>;
private void AddAmbiguousNavigations(Entity entity, IEnumerable<PropertyInfo> navigationProperties)
{
var ambiguousNavigations = GetAmbigousNavigations(entity) ?? new SortedDictionary<PropertyInfo, Type>(PropertyInfoNameComparer.Instance);
entity.RemoveAnnotation(AMBIGUOUS_NAVIGATIONS_ANNOTATION_NAME);
navigationProperties.ToList().ForEach(x => ambiguousNavigations.Add(x, entity.ClrType));
entity.AddAnnotation(AMBIGUOUS_NAVIGATIONS_ANNOTATION_NAME, ambiguousNavigations);
}
private bool RemoveAmbiguous(Entity entity, PropertyInfo navigationProperty)
{
var ambigousNavigations = GetAmbigousNavigations(entity);
if (ambigousNavigations != null)
{
if (ambigousNavigations.Remove(navigationProperty))
{
AddAmbiguousNavigations(entity, ambigousNavigations.Keys);
return true;
}
}
return false;
}
private class RelationshipCandidate
{
public RelationshipCandidate(Entity targetEntity, HashSet<PropertyInfo> navigations, HashSet<PropertyInfo> inverseNavigations)
{
TargetEntity = targetEntity;
NavigationProperties = navigations;
InverseProperties = inverseNavigations;
}
public Entity TargetEntity { get; }
public HashSet<PropertyInfo> NavigationProperties { get; }
public HashSet<PropertyInfo> InverseProperties { get; set; }
}
private class PropertyInfoNameComparer : IComparer<PropertyInfo>
{
public static readonly PropertyInfoNameComparer Instance = new PropertyInfoNameComparer();
private PropertyInfoNameComparer()
{
}
public int Compare(PropertyInfo x, PropertyInfo y) => StringComparer.Ordinal.Compare(x.Name, y.Name);
}
}
}
| 48.653125 | 202 | 0.574475 | [
"MIT"
] | lecaillon/Foundation | src/Foundation/Metadata/Conventions/RelationshipDiscoveryConvention.cs | 15,571 | C# |
/*******************************************************************************
* You may amend and distribute as you like, but don't remove this header!
*
* EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
* See https://github.com/JanKallman/EPPlus for details.
*
* Copyright (C) 2011 Jan Källman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
* If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
*
* All code and executables are provided "as is" with no warranty either express or implied.
* The author accepts no liability for any damage or loss of business that this product may cause.
*
* Code change notes:
*
* Author Change Date
* ******************************************************************************
* Mats Alm Added 2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
*******************************************************************************/
using System;
namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
{
public class CompileResultFactory
{
public virtual CompileResult Create(object obj)
{
if ((obj is ExcelDataProvider.INameInfo))
{
obj = ((ExcelDataProvider.INameInfo)obj).Value;
}
if (obj is ExcelDataProvider.IRangeInfo)
{
obj = ((ExcelDataProvider.IRangeInfo)obj).GetOffset(0, 0);
}
if (obj == null) return new CompileResult(null, DataType.Empty);
if (obj.GetType().Equals(typeof(string)))
{
return new CompileResult(obj, DataType.String);
}
if (obj.GetType().Equals(typeof(double)) || obj is decimal)
{
return new CompileResult(obj, DataType.Decimal);
}
if (obj.GetType().Equals(typeof(int)) || obj is long || obj is short)
{
return new CompileResult(obj, DataType.Integer);
}
if (obj.GetType().Equals(typeof(bool)))
{
return new CompileResult(obj, DataType.Boolean);
}
if (obj.GetType().Equals(typeof(ExcelErrorValue)))
{
return new CompileResult(obj, DataType.ExcelError);
}
if (obj.GetType().Equals(typeof(System.DateTime)))
{
return new CompileResult(((System.DateTime)obj).ToOADate(), DataType.Date);
}
throw new ArgumentException("Non supported type " + obj.GetType().FullName);
}
}
}
| 43.118421 | 132 | 0.575832 | [
"MIT"
] | Afonsof91/Magicodes.IE | src/EPPlus/EPPlus/FormulaParsing/ExpressionGraph/CompileResultFactory.cs | 3,280 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.SolutionCrawler;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Preview
{
[ExportWorkspaceServiceFactory(typeof(ISolutionCrawlerRegistrationService), WorkspaceKind.Preview), Shared]
internal class PreviewSolutionCrawlerRegistrationServiceFactory : IWorkspaceServiceFactory
{
private readonly DiagnosticAnalyzerService _analyzerService;
private readonly IAsynchronousOperationListener _listener;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public PreviewSolutionCrawlerRegistrationServiceFactory(IDiagnosticAnalyzerService analyzerService, IAsynchronousOperationListenerProvider listenerProvider)
{
// this service is directly tied to DiagnosticAnalyzerService and
// depends on its implementation.
_analyzerService = (DiagnosticAnalyzerService)analyzerService;
_listener = listenerProvider.GetListener(FeatureAttribute.DiagnosticService);
}
public IWorkspaceService? CreateService(HostWorkspaceServices workspaceServices)
{
// to make life time management easier, just create new service per new workspace
return new Service(this, workspaceServices.Workspace);
}
// internal for testing
internal class Service : ISolutionCrawlerRegistrationService
{
private readonly PreviewSolutionCrawlerRegistrationServiceFactory _owner;
private readonly Workspace _workspace;
private readonly CancellationTokenSource _source;
// since we now have one service for each one specific instance of workspace,
// we can have states for this specific workspace.
private Task? _analyzeTask;
public Service(PreviewSolutionCrawlerRegistrationServiceFactory owner, Workspace workspace)
{
_owner = owner;
_workspace = workspace;
_source = new CancellationTokenSource();
}
public void Register(Workspace workspace)
{
// given workspace must be owner of this workspace service
Contract.ThrowIfFalse(workspace == _workspace);
// this can't be called twice
Contract.ThrowIfFalse(_analyzeTask == null);
var asyncToken = _owner._listener.BeginAsyncOperation(nameof(PreviewSolutionCrawlerRegistrationServiceFactory) + "." + nameof(Service) + "." + nameof(Register));
_analyzeTask = AnalyzeAsync().CompletesAsyncOperation(asyncToken);
}
private async Task AnalyzeAsync()
{
var workerBackOffTimeSpan = SolutionCrawlerTimeSpan.PreviewBackOff;
var incrementalAnalyzer = _owner._analyzerService.CreateIncrementalAnalyzer(_workspace);
var solution = _workspace.CurrentSolution;
var documentIds = _workspace.GetOpenDocumentIds().ToImmutableArray();
try
{
foreach (var documentId in documentIds)
{
var textDocument = solution.GetTextDocument(documentId);
if (textDocument == null)
{
continue;
}
// delay analyzing
await _owner._listener.Delay(workerBackOffTimeSpan, _source.Token).ConfigureAwait(false);
// do actual analysis
if (textDocument is Document document)
{
await incrementalAnalyzer.AnalyzeSyntaxAsync(document, InvocationReasons.Empty, _source.Token).ConfigureAwait(false);
await incrementalAnalyzer.AnalyzeDocumentAsync(document, bodyOpt: null, reasons: InvocationReasons.Empty, cancellationToken: _source.Token).ConfigureAwait(false);
}
else
{
await incrementalAnalyzer.AnalyzeNonSourceDocumentAsync(textDocument, InvocationReasons.Empty, _source.Token).ConfigureAwait(false);
}
// don't call project one.
}
}
catch (OperationCanceledException)
{
// do nothing
}
}
public void Unregister(Workspace workspace, bool blockingShutdown = false)
=> _ = UnregisterAsync(workspace);
private async Task UnregisterAsync(Workspace workspace)
{
Contract.ThrowIfFalse(workspace == _workspace);
Contract.ThrowIfNull(_analyzeTask);
_source.Cancel();
// wait for analyzer work to be finished
await _analyzeTask.ConfigureAwait(false);
// ask it to reset its stages for the given workspace
_owner._analyzerService.ShutdownAnalyzerFrom(_workspace);
}
public void AddAnalyzerProvider(IIncrementalAnalyzerProvider provider, IncrementalAnalyzerProviderMetadata metadata)
{
// preview solution crawler doesn't support adding and removing analyzer dynamically
throw new NotSupportedException();
}
}
}
}
| 43.719424 | 190 | 0.632714 | [
"MIT"
] | AlexanderSemenyak/roslyn | src/EditorFeatures/Core/Shared/Preview/PreviewSolutionCrawlerRegistrationService.cs | 6,079 | C# |
using System.Collections.Generic;
using CloudFlare.Client.Api.Accounts.Subscriptions;
using CloudFlare.Client.Test.Helpers;
using FluentAssertions;
using Xunit;
namespace CloudFlare.Client.Test.Serialization
{
public class ComponentValueTest
{
[Fact]
public void TestSerialization()
{
var sut = new ComponentValue();
JsonHelper.GetSerializedKeys(sut).Should().BeEquivalentTo(new SortedSet<string> { "name", "value", "default", "price" });
}
}
} | 27.105263 | 133 | 0.681553 | [
"MIT"
] | UmbHost/CloudFlare.Client | CloudFlare.Client.Test/Serialization/ComponentValueTest.cs | 517 | C# |
using SpeccyCommon;
namespace Speccy
{
public class ULA_Plus : IODevice
{
public event ULAOutEventHandler ULAOutEvent;
public bool Responded { get; set; }
// Following values taken from generic colour palette from ULA plus site
public int[] Palette = new int[64] { 0x000000, 0x404040, 0xff0000,0xff6a00,0xffd800,0xb6ff00,0x4cff00,0x00ff21,
0x00ff90,0x00ffff,0x0094ff,0x0026ff,0x4800ff,0xb200ff,0xff00dc,0xff006e,
0xffffff,0x808080,0x7f0000,0x7f3300,0x7f6a00,0x5b7f00,0x267f00,0x007f0e,
0x007f46,0x007f7f,0x004a7f,0x00137f,0x21007f,0x57007f,0x7f006e,0x7f0037,
0xa0a0a0,0x303030,0xff7f7f,0xffb27f,0xffe97f,0xdaff7f,0xa5ff7f,0x7fff8e,
0x7fffc5,0x7fffff,0x7fc9ff,0x7f92ff,0xa17fff,0xd67fff,0xff7fed,0xff7fb6,
0xc0c0c0,0x606060,0x7f3f3f,0x7f593f,0x7f743f,0x6d7f3f,0x527f3f,0x3f7f47,
0x3f7f62,0x3f7f7f,0x3f647f,0x3f497f,0x503f7f,0x6b3f7f,0x7f3f76,0x7f3f5b
};
public bool Enabled = false;
protected int GroupMode = 0; //0 = palette group, 1 = mode group
public int PaletteGroup = 0;
public bool PaletteEnabled = false;
public SPECCY_DEVICE DeviceID { get { return SPECCY_DEVICE.ULA_PLUS; } }
protected byte lastULAPlusOut = 0;
public byte In(ushort port) {
byte result = 0xff;
Responded = false;
if (Enabled && port == 0xff3b) {
Responded = true;
result = lastULAPlusOut;
}
return result;
}
public void Out(ushort port, byte val) {
Responded = false;
if (Enabled) {
if (port == 0xbf3b) {
Responded = true;
int mode = (val & 0xc0) >> 6;
//mode group
if (mode == 1) {
GroupMode = 1;
}
else if (mode == 0) //palette group
{
GroupMode = 0;
PaletteGroup = val & 0x3f;
}
}
else if (port == 0xff3b) {
Responded = true;
if (lastULAPlusOut != val && ULAOutEvent != null) {
ULAOutEvent();
}
lastULAPlusOut = val;
if (GroupMode == 1) {
PaletteEnabled = (val & 0x01) != 0;
}
else {
// code below by evolutional(discord).
int r = (val & 0b00011100) >> 2;
int g = (val & 0b11100000) >> 5;
int b = (val & 0b00000011) << 1;
if (b != 0) {
b |= 0x1;
}
r = (r << 5) | (r << 2) | (r >> 1);
g = (g << 5) | (g << 2) | (g >> 1);
b = (b << 5) | (b << 2) | (b >> 1);
Palette[PaletteGroup] = r << 16 | g << 8 | b;
}
}
}
}
public void RegisterDevice(zx_spectrum speccyModel) {
speccyModel.io_devices.Remove(this);
speccyModel.io_devices.Add(this);
ULAOutEvent += speccyModel.UpdateScreenBuffer;
Enabled = true;
}
public void Reset() {
lastULAPlusOut = 0;
GroupMode = 0;
PaletteGroup = 0;
}
public void UnregisterDevice(zx_spectrum speccyModel) {
ULAOutEvent -= speccyModel.UpdateScreenBuffer;
speccyModel.io_devices.Remove(this);
Enabled = false;
}
}
}
| 38.425926 | 124 | 0.436867 | [
"MIT"
] | ArjunNair/Zero-Emulator | Ziggy/Speccy/Devices/ULA_Plus.cs | 4,152 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Data.Common;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace System.Data.Odbc
{
internal abstract class OdbcHandle : SafeHandle
{
private readonly ODBC32.SQL_HANDLE _handleType;
private OdbcHandle _parentHandle;
protected OdbcHandle(ODBC32.SQL_HANDLE handleType, OdbcHandle parentHandle) : base(IntPtr.Zero, true)
{
_handleType = handleType;
bool mustRelease = false;
ODBC32.RetCode retcode = ODBC32.RetCode.SUCCESS;
try
{
// validate handleType
switch (handleType)
{
case ODBC32.SQL_HANDLE.ENV:
Debug.Assert(null == parentHandle, "did not expect a parent handle");
retcode = Interop.Odbc.SQLAllocHandle(handleType, IntPtr.Zero, out base.handle);
break;
case ODBC32.SQL_HANDLE.DBC:
case ODBC32.SQL_HANDLE.STMT:
// must addref before calling native so it won't be released just after
Debug.Assert(null != parentHandle, "expected a parent handle"); // safehandle can't be null
parentHandle.DangerousAddRef(ref mustRelease);
retcode = Interop.Odbc.SQLAllocHandle(handleType, parentHandle, out base.handle);
break;
// case ODBC32.SQL_HANDLE.DESC:
default:
Debug.Fail("unexpected handleType");
break;
}
}
finally
{
if (mustRelease)
{
switch (handleType)
{
case ODBC32.SQL_HANDLE.DBC:
case ODBC32.SQL_HANDLE.STMT:
if (IntPtr.Zero != base.handle)
{
// must assign _parentHandle after a handle is actually created
// since ReleaseHandle will only call DangerousRelease if a handle exists
_parentHandle = parentHandle;
}
else
{
// without a handle, ReleaseHandle may not be called
parentHandle.DangerousRelease();
}
break;
}
}
}
if ((ADP.PtrZero == base.handle) || (ODBC32.RetCode.SUCCESS != retcode))
{
//
throw ODBC.CantAllocateEnvironmentHandle(retcode);
}
}
internal OdbcHandle(OdbcStatementHandle parentHandle, ODBC32.SQL_ATTR attribute) : base(IntPtr.Zero, true)
{
Debug.Assert((ODBC32.SQL_ATTR.APP_PARAM_DESC == attribute) || (ODBC32.SQL_ATTR.APP_ROW_DESC == attribute), "invalid attribute");
_handleType = ODBC32.SQL_HANDLE.DESC;
int cbActual;
ODBC32.RetCode retcode;
bool mustRelease = false;
try
{
// must addref before calling native so it won't be released just after
parentHandle.DangerousAddRef(ref mustRelease);
retcode = parentHandle.GetStatementAttribute(attribute, out base.handle, out cbActual);
}
finally
{
if (mustRelease)
{
if (IntPtr.Zero != base.handle)
{
// must call DangerousAddRef after a handle is actually created
// since ReleaseHandle will only call DangerousRelease if a handle exists
_parentHandle = parentHandle;
}
else
{
// without a handle, ReleaseHandle may not be called
parentHandle.DangerousRelease();
}
}
}
if (ADP.PtrZero == base.handle)
{
throw ODBC.FailedToGetDescriptorHandle(retcode);
}
// no info-message handle on getting a descriptor handle
}
internal ODBC32.SQL_HANDLE HandleType
{
get
{
return _handleType;
}
}
public override bool IsInvalid
{
get
{
// we should not have a parent if we do not have a handle
return (IntPtr.Zero == base.handle);
}
}
protected override bool ReleaseHandle()
{
// NOTE: The SafeHandle class guarantees this will be called exactly once and is non-interrutible.
IntPtr handle = base.handle;
base.handle = IntPtr.Zero;
if (IntPtr.Zero != handle)
{
ODBC32.SQL_HANDLE handleType = HandleType;
switch (handleType)
{
case ODBC32.SQL_HANDLE.DBC:
// Disconnect happens in OdbcConnectionHandle.ReleaseHandle
case ODBC32.SQL_HANDLE.ENV:
case ODBC32.SQL_HANDLE.STMT:
Interop.Odbc.SQLFreeHandle(handleType, handle);
break;
case ODBC32.SQL_HANDLE.DESC:
// nothing to free on the handle
break;
// case 0: ThreadAbortException setting handle before HandleType
default:
Debug.Assert(ADP.PtrZero == handle, "unknown handle type");
break;
}
}
// If we ended up getting released, then we have to release
// our reference on our parent.
OdbcHandle parentHandle = _parentHandle;
_parentHandle = null;
if (null != parentHandle)
{
parentHandle.DangerousRelease();
parentHandle = null;
}
return true;
}
internal ODBC32.RetCode GetDiagnosticField(out string sqlState)
{
short cbActual;
// ODBC (MSDN) documents it expects a buffer large enough to hold 5(+L'\0') unicode characters
StringBuilder sb = new StringBuilder(6);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetDiagFieldW(
HandleType,
this,
(short)1,
ODBC32.SQL_DIAG_SQLSTATE,
sb,
checked((short)(2 * sb.Capacity)), // expects number of bytes, see \\kbinternal\kb\articles\294\1\69.HTM
out cbActual);
ODBC.TraceODBC(3, "SQLGetDiagFieldW", retcode);
if ((retcode == ODBC32.RetCode.SUCCESS) || (retcode == ODBC32.RetCode.SUCCESS_WITH_INFO))
{
sqlState = sb.ToString();
}
else
{
sqlState = string.Empty;
}
return retcode;
}
internal ODBC32.RetCode GetDiagnosticRecord(short record, out string sqlState, StringBuilder message, out int nativeError, out short cchActual)
{
// ODBC (MSDN) documents it expects a buffer large enough to hold 4(+L'\0') unicode characters
StringBuilder sb = new StringBuilder(5);
ODBC32.RetCode retcode = Interop.Odbc.SQLGetDiagRecW(HandleType, this, record, sb, out nativeError, message, checked((short)message.Capacity), out cchActual);
ODBC.TraceODBC(3, "SQLGetDiagRecW", retcode);
if ((retcode == ODBC32.RetCode.SUCCESS) || (retcode == ODBC32.RetCode.SUCCESS_WITH_INFO))
{
sqlState = sb.ToString();
}
else
{
sqlState = string.Empty;
}
return retcode;
}
}
internal sealed class OdbcDescriptorHandle : OdbcHandle
{
internal OdbcDescriptorHandle(OdbcStatementHandle statementHandle, ODBC32.SQL_ATTR attribute) : base(statementHandle, attribute)
{
}
internal ODBC32.RetCode GetDescriptionField(int i, ODBC32.SQL_DESC attribute, CNativeBuffer buffer, out int numericAttribute)
{
ODBC32.RetCode retcode = Interop.Odbc.SQLGetDescFieldW(this, checked((short)i), attribute, buffer, buffer.ShortLength, out numericAttribute);
ODBC.TraceODBC(3, "SQLGetDescFieldW", retcode);
return retcode;
}
internal ODBC32.RetCode SetDescriptionField1(short ordinal, ODBC32.SQL_DESC type, IntPtr value)
{
ODBC32.RetCode retcode = Interop.Odbc.SQLSetDescFieldW(this, ordinal, type, value, 0);
ODBC.TraceODBC(3, "SQLSetDescFieldW", retcode);
return retcode;
}
internal ODBC32.RetCode SetDescriptionField2(short ordinal, ODBC32.SQL_DESC type, HandleRef value)
{
ODBC32.RetCode retcode = Interop.Odbc.SQLSetDescFieldW(this, ordinal, type, value, 0);
ODBC.TraceODBC(3, "SQLSetDescFieldW", retcode);
return retcode;
}
}
}
| 38.751004 | 170 | 0.521712 | [
"MIT"
] | AustinWise/runtime | src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcHandle.cs | 9,649 | C# |
using System;
using System.Collections.Generic;
using NextGenSoftware.OASIS.API.Core.Enums;
using NextGenSoftware.OASIS.API.Core.Helpers;
using NextGenSoftware.OASIS.API.Core.Objects;
namespace NextGenSoftware.OASIS.API.Providers.MongoDBOASIS.Entities
{
public class AvatarDetail : Holon
{
public string UmaJson { get; set; }
public string Image2D { get; set; }
public string Title { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string FullName
{
get
{
return string.Concat(Title, " ", FirstName, " ", LastName);
}
}
public string Email { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Address { get; set; }
public string Postcode { get; set; }
public string Town { get; set; }
public string County { get; set; }
public string Country { get; set; }
public string Landline { get; set; }
public string Mobile { get; set; }
public DateTime DOB { get; set; }
public EnumValue<AvatarType> AvatarType { get; set; }
public EnumValue<OASISType> CreatedOASISType { get; set; }
public int Karma { get; set; }
public Dictionary<ProviderType, string> ProviderPrivateKey { get; set; } = new Dictionary<ProviderType, string>(); //Unique private key used by each provider (part of private/public key pair).
public Dictionary<ProviderType, string> ProviderPublicKey { get; set; } = new Dictionary<ProviderType, string>();
public Dictionary<ProviderType, string> ProviderUsername { get; set; } = new Dictionary<ProviderType, string>(); // This is only really needed when we need to store BOTH a id and username for a provider (ProviderKey on Holon already stores either id/username etc). // public Dictionary<ProviderType, string> ProviderId { get; set; } = new Dictionary<ProviderType, string>(); // The ProviderKey property on the base Holon object can store ids, usernames, etc that uniqueliy identity that holon in the provider (although the Guid is globally unique we still need to map the Holons the unique id/username/etc for each provider).
public Dictionary<ProviderType, string> ProviderWalletAddress { get; set; } = new Dictionary<ProviderType, string>();
public ConsoleColor FavouriteColour { get; set; }
public ConsoleColor STARCLIColour { get; set; }
public int XP { get; set; }
public List<AvatarGift> Gifts { get; set; } = new List<AvatarGift>();
public AvatarChakras Chakras { get; set; } = new AvatarChakras();
public AvatarAura Aura { get; set; } = new AvatarAura();
public AvatarStats Stats { get; set; } = new AvatarStats();
public List<GeneKey> GeneKeys { get; set; } = new List<GeneKey>();
public HumanDesign HumanDesign { get; set; } = new HumanDesign();
public AvatarSkills Skills { get; set; } = new AvatarSkills();
public AvatarAttributes Attributes { get; set; } = new AvatarAttributes();
public AvatarSuperPowers SuperPowers { get; set; } = new AvatarSuperPowers();
public List<Spell> Spells { get; set; } = new List<Spell>();
public List<Achievement> Achievements { get; set; } = new List<Achievement>();
public List<InventoryItem> Inventory { get; set; } = new List<InventoryItem>();
public List<KarmaAkashicRecord> KarmaAkashicRecords { get; set; }
public int Level { get; set; }
//public bool AcceptTerms { get; set; }
//public string VerificationToken { get; set; }
//public DateTime? Verified { get; set; }
//public bool IsVerified => Verified.HasValue || PasswordReset.HasValue;
//public string ResetToken { get; set; }
//public string JwtToken { get; set; }
//public string RefreshToken { get; set; }
//public List<RefreshToken> RefreshTokens { get; set; } = new List<RefreshToken>();
//public DateTime? ResetTokenExpires { get; set; }
//public DateTime? PasswordReset { get; set; }
}
} | 62.362319 | 738 | 0.636765 | [
"CC0-1.0"
] | neurip/Our-World-OASIS-API-HoloNET-HoloUnity-And-.NET-HDK | NextGenSoftware.OASIS.API.Providers.MongoOASIS/Entities/AvatarDetail.cs | 4,303 | C# |
using System.Collections.Generic;
using Mod;
using UnityEngine;
namespace Photon
{
public class PhotonStream
{
private byte currentItem;
internal List<object> data;
private bool write;
public PhotonStream(bool write, object[] incomingData)
{
this.write = write;
if (incomingData == null)
{
this.data = new List<object>();
}
else
{
this.data = new List<object>(incomingData);
}
}
public object ReceiveNext()
{
if (this.write)
{
Debug.LogError("Error: you cannot read this stream that you are writing!");
return null;
}
if (currentItem > data.Count - 1)
return null;
object obj2 = this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
return obj2;
}
public void SendNext(object obj)
{
if (!this.write)
{
Debug.LogError("Error: you cannot write/send to this stream that you are reading!");
}
else
{
this.data.Add(obj);
}
}
public void Serialize(ref Player obj)
{
if (this.write)
{
this.data.Add(obj);
}
else if (this.data.Count > this.currentItem)
{
obj = (Player) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref bool myBool)
{
if (this.write)
{
this.data.Add(myBool);
}
else if (this.data.Count > this.currentItem)
{
myBool = (bool) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref char value)
{
if (this.write)
{
this.data.Add(value);
}
else if (this.data.Count > this.currentItem)
{
value = (char) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref short value)
{
if (this.write)
{
this.data.Add(value);
}
else if (this.data.Count > this.currentItem)
{
value = (short) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref int myInt)
{
if (this.write)
{
this.data.Add(myInt);
}
else if (this.data.Count > this.currentItem)
{
myInt = (int) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref float obj)
{
if (this.write)
{
this.data.Add(obj);
}
else if (this.data.Count > this.currentItem)
{
obj = (float) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref string value)
{
if (this.write)
{
this.data.Add(value);
}
else if (this.data.Count > this.currentItem)
{
value = (string) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref Quaternion obj)
{
if (this.write)
{
this.data.Add(obj);
}
else if (this.data.Count > this.currentItem)
{
obj = (Quaternion) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref Vector2 obj)
{
if (this.write)
{
this.data.Add(obj);
}
else if (this.data.Count > this.currentItem)
{
obj = (Vector2) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public void Serialize(ref Vector3 obj)
{
if (this.write)
{
this.data.Add(obj);
}
else if (this.data.Count > this.currentItem)
{
obj = (Vector3) this.data[this.currentItem];
this.currentItem = (byte) (this.currentItem + 1);
}
}
public object[] ToArray()
{
return this.data.ToArray();
}
public int Count
{
get
{
return this.data.Count;
}
}
public bool isReading
{
get
{
return !this.write;
}
}
public bool isWriting
{
get
{
return this.write;
}
}
}
}
| 25.753488 | 100 | 0.427488 | [
"Apache-2.0"
] | ITALIA195/Shelter | Shelter/Photon/PhotonStream.cs | 5,537 | C# |
// Copyright 2015 XLGAMES Inc.
//
// Distributed under the MIT License (See
// accompanying file "LICENSE" or the website
// http://www.opensource.org/licenses/mit-license.php)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ModelViewer
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
visLayerController = new GUILayer.VisLayerController();
visSettings = GUILayer.ModelVisSettings.CreateDefault();
visLayerController.SetModelSettings(visSettings);
visLayerController.AttachToView(this.viewerControl.Underlying);
viewSettings.SelectedObject = visSettings;
visMouseOver = visLayerController.MouseOver;
if (visMouseOver != null)
{
mouseOverDetails.SelectedObject = visMouseOver;
visMouseOver.AttachCallback(mouseOverDetails);
}
viewerControl.MouseClick += OnViewerMouseClick;
viewerControl.Underlying.SetUpdateAsyncMan(true);
}
protected void ContextMenu_EditMaterial(object sender, EventArgs e)
{
if (visMouseOver != null && visMouseOver.HasMouseOver)
{
// pop-up a modal version of the material editor (for testing/prototyping)
if (visMouseOver.FullMaterialName != null)
{
using (var editor = new ModalMaterialEditor()) {
editor.PreviewModel = Tuple.Create(visMouseOver.ModelName, visMouseOver.MaterialBindingGuid);
editor.Object = visMouseOver.FullMaterialName;
editor.ShowDialog();
}
}
}
}
protected void ContextMenu_ShowModifications(object sender, EventArgs e)
{
var pendingAssetList = GUILayer.PendingSaveList.Create();
var assetList = new GUILayer.DivergentAssetList(GUILayer.EngineDevice.GetInstance(), pendingAssetList);
using (var dialog = new ControlsLibrary.ModifiedAssetsDialog())
{
dialog.AssetList = assetList;
var result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
var cmtResult = pendingAssetList.Commit();
// if we got some error messages during the commit; display them here...
if (!String.IsNullOrEmpty(cmtResult.ErrorMessages))
ControlsLibrary.BasicControls.TextWindow.ShowModal(cmtResult.ErrorMessages);
}
}
}
protected void ContextMenu_ShowInvalidAssets(object sender, EventArgs e)
{
using (var dialog = new ControlsLibrary.InvalidAssetDialog())
dialog.ShowDialog();
}
protected void OnViewerMouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right) {
ContextMenu cm = new ContextMenu();
cm.MenuItems.Add("Show Modifications", new EventHandler(ContextMenu_ShowModifications));
cm.MenuItems.Add("Show Invalid Assets", new EventHandler(ContextMenu_ShowInvalidAssets));
if (visMouseOver != null && visMouseOver.HasMouseOver)
cm.MenuItems.Add("Edit &Material", new EventHandler(ContextMenu_EditMaterial));
cm.Show(this, e.Location);
}
}
private GUILayer.ModelVisSettings visSettings;
private GUILayer.VisMouseOver visMouseOver;
private GUILayer.VisLayerController visLayerController;
}
}
| 36.952381 | 118 | 0.609021 | [
"MIT"
] | djewsbury/XLE | Samples/Legacy/ModelViewer/MainForm.cs | 3,882 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.