language
stringclasses
1 value
repo
stringclasses
133 values
path
stringlengths
13
229
class_span
dict
source
stringlengths
14
2.92M
target
stringlengths
1
153
csharp
mongodb__mongo-csharp-driver
src/MongoDB.Driver/Core/Misc/DecryptedSecureString.cs
{ "start": 725, "end": 3624 }
internal sealed class ____ : IDisposable { // private fields private char[] _chars; private GCHandle _charsHandle; private IntPtr _charsIntPtr; private bool _disposed; #pragma warning disable CA2213 // Disposable fields should be disposed private readonly SecureString _secureString; #pragma warning restore CA2213 // Disposable fields should be disposed private byte[] _utf8Bytes; private GCHandle _utf8BytesHandle; // constructors public DecryptedSecureString(SecureString secureString) { _secureString = Ensure.IsNotNull(secureString, nameof(secureString)); } // finalizer ~DecryptedSecureString() { Dispose(false); } // public methods public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } public char[] GetChars() { if (_chars == null) { _charsIntPtr = Marshal.SecureStringToGlobalAllocUnicode(_secureString); _chars = new char[_secureString.Length]; _charsHandle = GCHandle.Alloc(_chars, GCHandleType.Pinned); Marshal.Copy(_charsIntPtr, _chars, 0, _secureString.Length); } return _chars; } public byte[] GetUtf8Bytes() { if (_utf8Bytes == null) { var chars = GetChars(); var encoding = Utf8Encodings.Strict; _utf8Bytes = new byte[encoding.GetByteCount(chars)]; _utf8BytesHandle = GCHandle.Alloc(_utf8Bytes, GCHandleType.Pinned); encoding.GetBytes(chars, 0, chars.Length, _utf8Bytes, 0); } return _utf8Bytes; } // private methods private void Dispose(bool disposing) { if (!_disposed) { if (disposing) { if (_utf8Bytes != null) { Array.Clear(_utf8Bytes, 0, _utf8Bytes.Length); } if (_chars != null) { Array.Clear(_chars, 0, _chars.Length); } } if (_utf8BytesHandle.IsAllocated) { _utf8BytesHandle.Free(); } if (_charsHandle.IsAllocated) { _charsHandle.Free(); } if (_charsIntPtr != IntPtr.Zero) { Marshal.ZeroFreeGlobalAllocUnicode(_charsIntPtr); _charsIntPtr = IntPtr.Zero; // to facilitate testing } _disposed = true; } } } }
DecryptedSecureString
csharp
dotnet__efcore
test/EFCore.Specification.Tests/ModelBuilding/GiantModel.cs
{ "start": 99537, "end": 99754 }
public class ____ { public int Id { get; set; } public RelatedEntity459 ParentEntity { get; set; } public IEnumerable<RelatedEntity461> ChildEntities { get; set; } }
RelatedEntity460
csharp
ServiceStack__ServiceStack
ServiceStack/tests/ServiceStack.Extensions.Tests/Protoc/Services.cs
{ "start": 2897657, "end": 2913940 }
partial class ____ : pb::IMessage<UpdateRockstarVersion> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<UpdateRockstarVersion> _parser = new pb::MessageParser<UpdateRockstarVersion>(() => new UpdateRockstarVersion()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pb::MessageParser<UpdateRockstarVersion> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { get { return global::ServiceStack.Extensions.Tests.Protoc.ServicesReflection.Descriptor.MessageTypes[232]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public UpdateRockstarVersion() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public UpdateRockstarVersion(UpdateRockstarVersion other) : this() { firstName_ = other.firstName_; lastName_ = other.lastName_; age_ = other.age_; dateOfBirth_ = other.dateOfBirth_ != null ? other.dateOfBirth_.Clone() : null; dateDied_ = other.dateDied_ != null ? other.dateDied_.Clone() : null; livingStatus_ = other.livingStatus_; id_ = other.id_; rowVersion_ = other.rowVersion_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public UpdateRockstarVersion Clone() { return new UpdateRockstarVersion(this); } /// <summary>Field number for the "FirstName" field.</summary> public const int FirstNameFieldNumber = 1; private string firstName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string FirstName { get { return firstName_; } set { firstName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "LastName" field.</summary> public const int LastNameFieldNumber = 2; private string lastName_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public string LastName { get { return lastName_; } set { lastName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "Age" field.</summary> public const int AgeFieldNumber = 3; private int age_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Age { get { return age_; } set { age_ = value; } } /// <summary>Field number for the "DateOfBirth" field.</summary> public const int DateOfBirthFieldNumber = 4; private global::Google.Protobuf.WellKnownTypes.Timestamp dateOfBirth_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Google.Protobuf.WellKnownTypes.Timestamp DateOfBirth { get { return dateOfBirth_; } set { dateOfBirth_ = value; } } /// <summary>Field number for the "DateDied" field.</summary> public const int DateDiedFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.Timestamp dateDied_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::Google.Protobuf.WellKnownTypes.Timestamp DateDied { get { return dateDied_; } set { dateDied_ = value; } } /// <summary>Field number for the "LivingStatus" field.</summary> public const int LivingStatusFieldNumber = 6; private global::ServiceStack.Extensions.Tests.Protoc.LivingStatus livingStatus_ = global::ServiceStack.Extensions.Tests.Protoc.LivingStatus.Alive; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public global::ServiceStack.Extensions.Tests.Protoc.LivingStatus LivingStatus { get { return livingStatus_; } set { livingStatus_ = value; } } /// <summary>Field number for the "Id" field.</summary> public const int IdFieldNumber = 101; private int id_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int Id { get { return id_; } set { id_ = value; } } /// <summary>Field number for the "RowVersion" field.</summary> public const int RowVersionFieldNumber = 102; private ulong rowVersion_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public ulong RowVersion { get { return rowVersion_; } set { rowVersion_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { return Equals(other as UpdateRockstarVersion); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public bool Equals(UpdateRockstarVersion other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (FirstName != other.FirstName) return false; if (LastName != other.LastName) return false; if (Age != other.Age) return false; if (!object.Equals(DateOfBirth, other.DateOfBirth)) return false; if (!object.Equals(DateDied, other.DateDied)) return false; if (LivingStatus != other.LivingStatus) return false; if (Id != other.Id) return false; if (RowVersion != other.RowVersion) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); if (LastName.Length != 0) hash ^= LastName.GetHashCode(); if (Age != 0) hash ^= Age.GetHashCode(); if (dateOfBirth_ != null) hash ^= DateOfBirth.GetHashCode(); if (dateDied_ != null) hash ^= DateDied.GetHashCode(); if (LivingStatus != global::ServiceStack.Extensions.Tests.Protoc.LivingStatus.Alive) hash ^= LivingStatus.GetHashCode(); if (Id != 0) hash ^= Id.GetHashCode(); if (RowVersion != 0UL) hash ^= RowVersion.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (FirstName.Length != 0) { output.WriteRawTag(10); output.WriteString(FirstName); } if (LastName.Length != 0) { output.WriteRawTag(18); output.WriteString(LastName); } if (Age != 0) { output.WriteRawTag(24); output.WriteInt32(Age); } if (dateOfBirth_ != null) { output.WriteRawTag(34); output.WriteMessage(DateOfBirth); } if (dateDied_ != null) { output.WriteRawTag(42); output.WriteMessage(DateDied); } if (LivingStatus != global::ServiceStack.Extensions.Tests.Protoc.LivingStatus.Alive) { output.WriteRawTag(48); output.WriteEnum((int) LivingStatus); } if (Id != 0) { output.WriteRawTag(168, 6); output.WriteInt32(Id); } if (RowVersion != 0UL) { output.WriteRawTag(176, 6); output.WriteUInt64(RowVersion); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (FirstName.Length != 0) { output.WriteRawTag(10); output.WriteString(FirstName); } if (LastName.Length != 0) { output.WriteRawTag(18); output.WriteString(LastName); } if (Age != 0) { output.WriteRawTag(24); output.WriteInt32(Age); } if (dateOfBirth_ != null) { output.WriteRawTag(34); output.WriteMessage(DateOfBirth); } if (dateDied_ != null) { output.WriteRawTag(42); output.WriteMessage(DateDied); } if (LivingStatus != global::ServiceStack.Extensions.Tests.Protoc.LivingStatus.Alive) { output.WriteRawTag(48); output.WriteEnum((int) LivingStatus); } if (Id != 0) { output.WriteRawTag(168, 6); output.WriteInt32(Id); } if (RowVersion != 0UL) { output.WriteRawTag(176, 6); output.WriteUInt64(RowVersion); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; if (FirstName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(FirstName); } if (LastName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(LastName); } if (Age != 0) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(Age); } if (dateOfBirth_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateOfBirth); } if (dateDied_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(DateDied); } if (LivingStatus != global::ServiceStack.Extensions.Tests.Protoc.LivingStatus.Alive) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LivingStatus); } if (Id != 0) { size += 2 + pb::CodedOutputStream.ComputeInt32Size(Id); } if (RowVersion != 0UL) { size += 2 + pb::CodedOutputStream.ComputeUInt64Size(RowVersion); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(UpdateRockstarVersion other) { if (other == null) { return; } if (other.FirstName.Length != 0) { FirstName = other.FirstName; } if (other.LastName.Length != 0) { LastName = other.LastName; } if (other.Age != 0) { Age = other.Age; } if (other.dateOfBirth_ != null) { if (dateOfBirth_ == null) { DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } DateOfBirth.MergeFrom(other.DateOfBirth); } if (other.dateDied_ != null) { if (dateDied_ == null) { DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } DateDied.MergeFrom(other.DateDied); } if (other.LivingStatus != global::ServiceStack.Extensions.Tests.Protoc.LivingStatus.Alive) { LivingStatus = other.LivingStatus; } if (other.Id != 0) { Id = other.Id; } if (other.RowVersion != 0UL) { RowVersion = other.RowVersion; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { FirstName = input.ReadString(); break; } case 18: { LastName = input.ReadString(); break; } case 24: { Age = input.ReadInt32(); break; } case 34: { if (dateOfBirth_ == null) { DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(DateOfBirth); break; } case 42: { if (dateDied_ == null) { DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(DateDied); break; } case 48: { LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); break; } case 808: { Id = input.ReadInt32(); break; } case 816: { RowVersion = input.ReadUInt64(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { FirstName = input.ReadString(); break; } case 18: { LastName = input.ReadString(); break; } case 24: { Age = input.ReadInt32(); break; } case 34: { if (dateOfBirth_ == null) { DateOfBirth = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(DateOfBirth); break; } case 42: { if (dateDied_ == null) { DateDied = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(DateDied); break; } case 48: { LivingStatus = (global::ServiceStack.Extensions.Tests.Protoc.LivingStatus) input.ReadEnum(); break; } case 808: { Id = input.ReadInt32(); break; } case 816: { RowVersion = input.ReadUInt64(); break; } } } } #endif } public sealed
UpdateRockstarVersion
csharp
microsoft__FASTER
cs/src/core/VarLen/VarLenHeapContainer.cs
{ "start": 255, "end": 968 }
internal class ____<T> : IHeapContainer<T> { readonly SectorAlignedMemory mem; readonly IVariableLengthStruct<T> varLenStruct; public unsafe VarLenHeapContainer(ref T obj, IVariableLengthStruct<T> varLenStruct, SectorAlignedBufferPool pool) { this.varLenStruct = varLenStruct; var len = varLenStruct.GetLength(ref obj); mem = pool.Get(len); varLenStruct.Serialize(ref obj, mem.GetValidPointer()); } public unsafe ref T Get() { return ref varLenStruct.AsRef(mem.GetValidPointer()); } public void Dispose() { mem.Return(); } } }
VarLenHeapContainer
csharp
dotnet__aspnetcore
src/Hosting/Hosting/test/Fakes/FakeOptions.cs
{ "start": 185, "end": 339 }
public class ____ { public bool Configured { get; set; } public string Environment { get; set; } public string Message { get; set; } }
FakeOptions
csharp
dotnet__efcore
src/EFCore/DbFunctions.cs
{ "start": 588, "end": 1812 }
public sealed class ____ { private DbFunctions() { } internal static DbFunctions Instance { get; } = new(); #region Hidden System.Object members /// <summary> /// Returns a string that represents the current object. /// </summary> /// <returns>A string that represents the current object.</returns> [EditorBrowsable(EditorBrowsableState.Never)] public override string? ToString() => base.ToString(); /// <summary> /// Determines whether the specified object is equal to the current object. /// </summary> /// <param name="obj">The object to compare with the current object.</param> /// <returns><see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" />.</returns> [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => base.Equals(obj); /// <summary> /// Serves as the default hash function. /// </summary> /// <returns>A hash code for the current object.</returns> [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => base.GetHashCode(); #endregion }
DbFunctions
csharp
dotnet__aspnetcore
src/Mvc/test/Mvc.IntegrationTests/ComplexRecordIntegrationTest.cs
{ "start": 87720, "end": 92837 }
private record ____([BindRequired] List<int> OrderIds); [Fact] public async Task WithRequiredCollectionProperty_NoData_GetsErrors() { // Arrange var parameter = new ParameterDescriptor() { Name = "parameter", ParameterType = typeof(Order13) }; // No Data var testContext = ModelBindingTestHelper.GetTestContext(request => { request.QueryString = new QueryString("?"); }); var modelState = testContext.ModelState; var metadata = GetMetadata(testContext, parameter); var modelBinder = GetModelBinder(testContext, parameter, metadata); var valueProvider = await CompositeValueProvider.CreateAsync(testContext); var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext); // Act var modelBindingResult = await parameterBinder.BindModelAsync( testContext, modelBinder, valueProvider, parameter, metadata, value: null); // Assert Assert.True(modelBindingResult.IsModelSet); var model = Assert.IsType<Order13>(modelBindingResult.Model); Assert.Null(model.OrderIds); Assert.Single(modelState); Assert.Equal(1, modelState.ErrorCount); Assert.False(modelState.IsValid); var entry = Assert.Single(modelState, e => e.Key == "OrderIds").Value; Assert.Null(entry.RawValue); Assert.Null(entry.AttemptedValue); var error = Assert.Single(modelState["OrderIds"].Errors); Assert.Equal("A value for the 'OrderIds' parameter or property was not provided.", error.ErrorMessage); } [Fact] public async Task WithRequiredCollectionProperty_NoData_CustomPrefix_GetsErrors() { // Arrange var parameter = new ParameterDescriptor() { Name = "parameter", ParameterType = typeof(Order13), BindingInfo = new BindingInfo() { BinderModelName = "customParameter" } }; // No Data var testContext = ModelBindingTestHelper.GetTestContext(request => { request.QueryString = new QueryString("?"); }); var modelState = testContext.ModelState; var metadata = GetMetadata(testContext, parameter); var modelBinder = GetModelBinder(testContext, parameter, metadata); var valueProvider = await CompositeValueProvider.CreateAsync(testContext); var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext); // Act var modelBindingResult = await parameterBinder.BindModelAsync( testContext, modelBinder, valueProvider, parameter, metadata, value: null); // Assert Assert.True(modelBindingResult.IsModelSet); var model = Assert.IsType<Order13>(modelBindingResult.Model); Assert.Null(model.OrderIds); Assert.Single(modelState); Assert.Equal(1, modelState.ErrorCount); Assert.False(modelState.IsValid); var entry = Assert.Single(modelState, e => e.Key == "customParameter.OrderIds").Value; Assert.Null(entry.RawValue); Assert.Null(entry.AttemptedValue); var error = Assert.Single(modelState["customParameter.OrderIds"].Errors); Assert.Equal("A value for the 'OrderIds' parameter or property was not provided.", error.ErrorMessage); } [Fact] public async Task WithRequiredCollectionProperty_WithData_EmptyPrefix_GetsBound() { // Arrange var parameter = new ParameterDescriptor() { Name = "parameter", ParameterType = typeof(Order13), }; var testContext = ModelBindingTestHelper.GetTestContext(request => { request.QueryString = new QueryString("?OrderIds[0]=123"); }); var modelState = testContext.ModelState; var metadata = GetMetadata(testContext, parameter); var modelBinder = GetModelBinder(testContext, parameter, metadata); var valueProvider = await CompositeValueProvider.CreateAsync(testContext); var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext); // Act var modelBindingResult = await parameterBinder.BindModelAsync( testContext, modelBinder, valueProvider, parameter, metadata, value: null); // Assert Assert.True(modelBindingResult.IsModelSet); var model = Assert.IsType<Order13>(modelBindingResult.Model); Assert.Equal(new[] { 123 }, model.OrderIds.ToArray()); Assert.Single(modelState); Assert.Equal(0, modelState.ErrorCount); Assert.True(modelState.IsValid); var entry = Assert.Single(modelState, e => e.Key == "OrderIds[0]").Value; Assert.Equal("123", entry.RawValue); Assert.Equal("123", entry.AttemptedValue); }
Order13
csharp
dotnet__aspnetcore
src/Mvc/Mvc.Core/test/Formatters/FormatFilterTest.cs
{ "start": 636, "end": 14885 }
public enum ____ { RouteData, QueryData, RouteAndQueryData } [Theory] [InlineData("json", FormatSource.RouteData)] [InlineData("json", FormatSource.QueryData)] [InlineData("json", FormatSource.RouteAndQueryData)] public void FormatFilter_ContextContainsFormat_DefaultFormat(string format, FormatSource place) { // Arrange var mediaType = new StringSegment("application/json"); var mockObjects = new MockObjects(format, place); var resultExecutingContext = mockObjects.CreateResultExecutingContext(); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { }); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); // Assert Assert.Null(resourceExecutingContext.Result); // Act filter.OnResultExecuting(resultExecutingContext); // Assert var objectResult = Assert.IsType<ObjectResult>(resultExecutingContext.Result); Assert.Single(objectResult.ContentTypes); MediaTypeAssert.Equal(mediaType, objectResult.ContentTypes[0]); } [Fact] public void FormatFilter_ContextContainsFormat_InRouteAndQueryData() { // If the format is present in both route and query data, the one in route data wins // Arrange var mediaType = new StringSegment("application/json"); var mockObjects = new MockObjects("json", FormatSource.RouteData); var httpContext = new Mock<HttpContext>(); httpContext.Setup(c => c.Response).Returns(new Mock<HttpResponse>().Object); // Query contains xml httpContext.Setup(c => c.Request.Query.ContainsKey("format")).Returns(true); httpContext.Setup(c => c.Request.Query["format"]).Returns("xml"); // RouteData contains json var data = new RouteData(); data.Values.Add("format", "json"); var ac = new ActionContext(httpContext.Object, data, new ActionDescriptor()); var resultExecutingContext = new ResultExecutingContext( ac, new IFilterMetadata[] { }, new ObjectResult("Hello!"), controller: new object()); var resourceExecutingContext = new ResourceExecutingContext( ac, new IFilterMetadata[] { }, new List<IValueProviderFactory>()); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); filter.OnResultExecuting(resultExecutingContext); // Assert var objectResult = Assert.IsType<ObjectResult>(resultExecutingContext.Result); Assert.Single(objectResult.ContentTypes); MediaTypeAssert.Equal(mediaType, objectResult.ContentTypes[0]); } [Theory] [InlineData("foo", FormatSource.RouteData, "application/foo")] [InlineData("foo", FormatSource.QueryData, "application/foo")] [InlineData("foo", FormatSource.RouteAndQueryData, "application/foo")] public void FormatFilter_ContextContainsFormat_Custom( string format, FormatSource place, string contentType) { // Arrange var mediaType = new StringSegment(contentType); var mockObjects = new MockObjects(format, place); var resultExecutingContext = mockObjects.CreateResultExecutingContext(); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { }); mockObjects.MvcOptions.FormatterMappings.SetMediaTypeMappingForFormat( format, MediaTypeHeaderValue.Parse(contentType)); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); filter.OnResultExecuting(resultExecutingContext); // Assert var objectResult = Assert.IsType<ObjectResult>(resultExecutingContext.Result); Assert.Single(objectResult.ContentTypes); MediaTypeAssert.Equal(mediaType, objectResult.ContentTypes[0]); } [Theory] [InlineData("foo", FormatSource.RouteData)] [InlineData("foo", FormatSource.QueryData)] public void FormatFilter_ContextContainsNonExistingFormat( string format, FormatSource place) { // Arrange var mockObjects = new MockObjects(format, place); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { }); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); // Assert var actionResult = resourceExecutingContext.Result; Assert.IsType<NotFoundResult>(actionResult); } [Fact] public void FormatFilter_ContextDoesntContainFormat() { // Arrange var mockObjects = new MockObjects(); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { }); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); // Assert Assert.Null(resourceExecutingContext.Result); } [Theory] [InlineData("json", FormatSource.RouteData, "application/json")] [InlineData("json", FormatSource.QueryData, "application/json")] public void FormatFilter_ContextContainsFormat_ContainsProducesFilter_Matching( string format, FormatSource place, string contentType) { // Arrange var produces = new ProducesAttribute(contentType, new string[] { "application/foo", "text/bar" }); var mockObjects = new MockObjects(format, place); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { produces }); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); // Assert Assert.Null(resourceExecutingContext.Result); } [Fact] public void FormatFilter_LessSpecificThan_Produces() { // Arrange var produces = new ProducesAttribute("application/xml;version=1", new string[] { }); var mockObjects = new MockObjects("xml", FormatSource.RouteData); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { produces }); mockObjects.MvcOptions.FormatterMappings.SetMediaTypeMappingForFormat( "xml", MediaTypeHeaderValue.Parse("application/xml")); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); // Assert Assert.Null(resourceExecutingContext.Result); } [Fact] public void FormatFilter_MoreSpecificThan_Produces() { // Arrange var produces = new ProducesAttribute("application/xml", new string[] { }); var mockObjects = new MockObjects("xml", FormatSource.RouteData); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { produces }); mockObjects.MvcOptions.FormatterMappings.SetMediaTypeMappingForFormat( "xml", MediaTypeHeaderValue.Parse("application/xml;version=1")); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); // Assert var actionResult = resourceExecutingContext.Result; Assert.IsType<NotFoundResult>(actionResult); } [Theory] [InlineData("json", FormatSource.RouteData)] [InlineData("json", FormatSource.QueryData)] public void FormatFilter_ContextContainsFormat_ContainsProducesFilter_Conflicting( string format, FormatSource place) { // Arrange var produces = new ProducesAttribute("application/xml", new string[] { "application/foo", "text/bar" }); var mockObjects = new MockObjects(format, place); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { produces }); mockObjects.MvcOptions.FormatterMappings.SetMediaTypeMappingForFormat( "xml", MediaTypeHeaderValue.Parse("application/xml")); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); // Assert var result = Assert.IsType<NotFoundResult>(resourceExecutingContext.Result); } [Theory] [InlineData("", FormatSource.RouteData)] [InlineData(null, FormatSource.QueryData)] public void FormatFilter_ContextContainsFormat_Invalid( string format, FormatSource place) { // Arrange var mockObjects = new MockObjects(format, place); var resourceExecutingContext = mockObjects.CreateResourceExecutingContext(new IFilterMetadata[] { }); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); // Assert Assert.Null(resourceExecutingContext.Result); } [Theory] [InlineData("json", FormatSource.RouteData, "json")] [InlineData("json", FormatSource.QueryData, "json")] [InlineData("", FormatSource.RouteAndQueryData, null)] [InlineData(null, FormatSource.RouteAndQueryData, null)] public void FormatFilter_GetFormat( string input, FormatSource place, string expected) { // Arrange var mockObjects = new MockObjects(input, place); var context = mockObjects.CreateResultExecutingContext(); var filterAttribute = new FormatFilterAttribute(); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act var format = filter.GetFormat(context); // Assert Assert.Equal(expected, filter.GetFormat(context)); } [Fact] [ReplaceCulture("de-CH", "de-CH")] public void FormatFilter_GetFormat_UsesInvariantCulture() { // Arrange var mockObjects = new MockObjects(); var context = mockObjects.CreateResultExecutingContext(); context.RouteData.Values["format"] = new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)); var expected = "10/31/2018 07:37:38 -07:00"; var filterAttribute = new FormatFilterAttribute(); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act var format = filter.GetFormat(context); // Assert Assert.Equal(expected, filter.GetFormat(context)); } [Fact] public void FormatFilter_ExplicitContentType_SetOnObjectResult_TakesPrecedence() { // Arrange var mediaType = new StringSegment("application/foo"); var mockObjects = new MockObjects("json", FormatSource.QueryData); var httpContext = new Mock<HttpContext>(); httpContext.Setup(c => c.Response).Returns(new Mock<HttpResponse>().Object); httpContext.Setup(c => c.Request.Query["format"]).Returns("json"); var actionContext = new ActionContext(httpContext.Object, new RouteData(), new ActionDescriptor()); var objectResult = new ObjectResult("Hello!"); objectResult.ContentTypes.Add(new MediaTypeHeaderValue("application/foo")); var resultExecutingContext = new ResultExecutingContext( actionContext, new IFilterMetadata[] { }, objectResult, controller: new object()); var resourceExecutingContext = new ResourceExecutingContext( actionContext, new IFilterMetadata[] { }, new List<IValueProviderFactory>()); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); filter.OnResultExecuting(resultExecutingContext); // Assert var result = Assert.IsType<ObjectResult>(resultExecutingContext.Result); Assert.Single(result.ContentTypes); MediaTypeAssert.Equal(mediaType, result.ContentTypes[0]); } [Fact] public void FormatFilter_ExplicitContentType_SetOnResponse_TakesPrecedence() { // Arrange var mediaType = MediaTypeHeaderValue.Parse("application/foo"); var mockObjects = new MockObjects("json", FormatSource.QueryData); var response = new Mock<HttpResponse>(); response.Setup(r => r.ContentType).Returns("application/foo"); var httpContext = new Mock<HttpContext>(); httpContext.Setup(c => c.Response).Returns(response.Object); httpContext.Setup(c => c.Request.Query["format"]).Returns("json"); var actionContext = new ActionContext(httpContext.Object, new RouteData(), new ActionDescriptor()); var resultExecutingContext = new ResultExecutingContext( actionContext, new IFilterMetadata[] { }, new ObjectResult("Hello!"), controller: new object()); var resourceExecutingContext = new ResourceExecutingContext( actionContext, new IFilterMetadata[] { }, new List<IValueProviderFactory>()); var filter = new FormatFilter(mockObjects.OptionsManager, NullLoggerFactory.Instance); // Act filter.OnResourceExecuting(resourceExecutingContext); filter.OnResultExecuting(resultExecutingContext); // Assert var result = Assert.IsType<ObjectResult>(resultExecutingContext.Result); Assert.Empty(result.ContentTypes); }
FormatSource
csharp
mongodb__mongo-csharp-driver
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Serializers/IGroupingSerializerTests.cs
{ "start": 871, "end": 3714 }
public class ____ { [Fact] public void Equals_derived_should_return_false() { var x = new IGroupingSerializer<int, int>(Int32Serializer.Instance, Int32Serializer.Instance); var y = new DerivedFromIGroupingSerializer<int, int>(Int32Serializer.Instance, Int32Serializer.Instance); var result = x.Equals(y); result.Should().Be(false); } [Fact] public void Equals_null_should_return_false() { var x = new IGroupingSerializer<int, int>(Int32Serializer.Instance, Int32Serializer.Instance); var result = x.Equals(null); result.Should().Be(false); } [Fact] public void Equals_object_should_return_false() { var x = new IGroupingSerializer<int, int>(Int32Serializer.Instance, Int32Serializer.Instance); var y = new object(); var result = x.Equals(y); result.Should().Be(false); } [Fact] public void Equals_self_should_return_true() { var x = new IGroupingSerializer<int, int>(Int32Serializer.Instance, Int32Serializer.Instance); var result = x.Equals(x); result.Should().Be(true); } [Fact] public void Equals_with_equal_fields_should_return_true() { var x = new IGroupingSerializer<int, int>(Int32Serializer.Instance, Int32Serializer.Instance); var y = new IGroupingSerializer<int, int>(Int32Serializer.Instance, Int32Serializer.Instance); var result = x.Equals(y); result.Should().Be(true); } [Theory] [InlineData("elementSerializer")] [InlineData("keySerializer")] public void Equals_with_not_equal_field_should_return_false(string notEqualFieldName) { var int32Serializer1 = new Int32Serializer(BsonType.Int32); var int32Serializer2 = new Int32Serializer(BsonType.String); var x = new IGroupingSerializer<int, int>(int32Serializer1, int32Serializer1); var y = notEqualFieldName switch { "keySerializer" => new IGroupingSerializer<int, int>(int32Serializer2, int32Serializer1), "elementSerializer" => new IGroupingSerializer<int, int>(int32Serializer1, int32Serializer2), _ => throw new Exception() }; var result = x.Equals(y); result.Should().Be(false); } [Fact] public void GetHashCode_should_return_zero() { var x = new IGroupingSerializer<int, int>(Int32Serializer.Instance, Int32Serializer.Instance); var result = x.GetHashCode(); result.Should().Be(0); }
IGroupingSerializerTests
csharp
dotnet__extensions
bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/Program.cs
{ "start": 383, "end": 860 }
internal static class ____ { private static void Main(string[] args) { var doNotRequireSlnToRunBenchmarks = ManualConfig .Create(DefaultConfig.Instance) .AddJob(Job.MediumRun.WithToolchain(InProcessEmitToolchain.Instance)) .AddDiagnoser(MemoryDiagnoser.Default); BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, doNotRequireSlnToRunBenchmarks); } } }
Program
csharp
FluentValidation__FluentValidation
src/FluentValidation/DefaultValidatorExtensions.cs
{ "start": 69201, "end": 72102 }
enum ____ should be case sensitive</param> /// <returns></returns> public static IRuleBuilderOptions<T, string> IsEnumName<T>(this IRuleBuilder<T, string> ruleBuilder, Type enumType, bool caseSensitive = true) => ruleBuilder.SetValidator(new StringEnumValidator<T>(enumType, caseSensitive)); /// <summary> /// Defines child rules for a nested property. /// </summary> /// <param name="ruleBuilder">The rule builder.</param> /// <param name="action">Callback that will be invoked to build the rules.</param> /// <typeparam name="T"></typeparam> /// <typeparam name="TProperty"></typeparam> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static IRuleBuilderOptions<T, TProperty> ChildRules<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Action<InlineValidator<TProperty>> action) { if (action == null) throw new ArgumentNullException(nameof(action)); var validator = new ChildRulesContainer<TProperty>(); var parentValidator = ((IRuleBuilderInternal<T>) ruleBuilder).ParentValidator; string[] ruleSets; if (parentValidator is ChildRulesContainer<T> container && container.RuleSetsToApplyToChildRules != null) { ruleSets = container.RuleSetsToApplyToChildRules; } else { ruleSets = DefaultValidatorOptions.Configurable(ruleBuilder).RuleSets; } // Store the correct rulesets on the child validator in case // we have nested calls to ChildRules, which can then pick this up from // the parent validator. validator.RuleSetsToApplyToChildRules = ruleSets; action(validator); foreach(var rule in validator.Rules) { if (rule.RuleSets == null) { rule.RuleSets = ruleSets; } } return ruleBuilder.SetValidator(validator); } /// <summary> /// Defines one or more validators that can be used to validate sub-classes or implementors /// in an inheritance hierarchy. This is useful when the property being validated is an interface /// or base-class, but you want to define rules for properties of a specific subclass. /// </summary> /// <param name="ruleBuilder"></param> /// <param name="validatorConfiguration">Callback for setting up the inheritance validators.</param> /// <returns></returns> public static IRuleBuilderOptions<T, TProperty> SetInheritanceValidator<T,TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, Action<PolymorphicValidator<T, TProperty>> validatorConfiguration) { if (validatorConfiguration == null) throw new ArgumentNullException(nameof(validatorConfiguration)); var validator = new PolymorphicValidator<T, TProperty>(); validatorConfiguration(validator); return ruleBuilder.SetAsyncValidator(validator); } private static string GetDisplayName<T, TProperty>(MemberInfo member, Expression<Func<T, TProperty>> expression) => ValidatorOptions.Global.DisplayNameResolver(typeof(T), member, expression) ?? member?.Name.SplitPascalCase(); }
names
csharp
JoshClose__CsvHelper
tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesMapTests.cs
{ "start": 3130, "end": 3355 }
private class ____ : ClassMap<Foo> { public FooMap() { Map(m => m.Id); Map(m => m.Boolean); Parameter("id"); Parameter("boolean").TypeConverterOption.BooleanValues(false, true, "Bar"); } } } }
FooMap
csharp
MaterialDesignInXAML__MaterialDesignInXamlToolkit
src/MaterialDesignColors.Wpf/Recommended/LightBlueSwatch.cs
{ "start": 73, "end": 2452 }
public class ____ : ISwatch { public static Color LightBlue50 { get; } = (Color)ColorConverter.ConvertFromString("#E1F5FE"); public static Color LightBlue100 { get; } = (Color)ColorConverter.ConvertFromString("#B3E5FC"); public static Color LightBlue200 { get; } = (Color)ColorConverter.ConvertFromString("#81D4FA"); public static Color LightBlue300 { get; } = (Color)ColorConverter.ConvertFromString("#4FC3F7"); public static Color LightBlue400 { get; } = (Color)ColorConverter.ConvertFromString("#29B6F6"); public static Color LightBlue500 { get; } = (Color)ColorConverter.ConvertFromString("#03A9F4"); public static Color LightBlue600 { get; } = (Color)ColorConverter.ConvertFromString("#039BE5"); public static Color LightBlue700 { get; } = (Color)ColorConverter.ConvertFromString("#0288D1"); public static Color LightBlue800 { get; } = (Color)ColorConverter.ConvertFromString("#0277BD"); public static Color LightBlue900 { get; } = (Color)ColorConverter.ConvertFromString("#01579B"); public static Color LightBlueA100 { get; } = (Color)ColorConverter.ConvertFromString("#80D8FF"); public static Color LightBlueA200 { get; } = (Color)ColorConverter.ConvertFromString("#40C4FF"); public static Color LightBlueA400 { get; } = (Color)ColorConverter.ConvertFromString("#00B0FF"); public static Color LightBlueA700 { get; } = (Color)ColorConverter.ConvertFromString("#0091EA"); public string Name { get; } = "LightBlue"; public IDictionary<MaterialDesignColor, Color> Lookup { get; } = new Dictionary<MaterialDesignColor, Color> { { MaterialDesignColor.LightBlue50, LightBlue50 }, { MaterialDesignColor.LightBlue100, LightBlue100 }, { MaterialDesignColor.LightBlue200, LightBlue200 }, { MaterialDesignColor.LightBlue300, LightBlue300 }, { MaterialDesignColor.LightBlue400, LightBlue400 }, { MaterialDesignColor.LightBlue500, LightBlue500 }, { MaterialDesignColor.LightBlue600, LightBlue600 }, { MaterialDesignColor.LightBlue700, LightBlue700 }, { MaterialDesignColor.LightBlue800, LightBlue800 }, { MaterialDesignColor.LightBlue900, LightBlue900 }, { MaterialDesignColor.LightBlueA100, LightBlueA100 }, { MaterialDesignColor.LightBlueA200, LightBlueA200 }, { MaterialDesignColor.LightBlueA400, LightBlueA400 }, { MaterialDesignColor.LightBlueA700, LightBlueA700 }, }; public IEnumerable<Color> Hues => Lookup.Values; }
LightBlueSwatch
csharp
SixLabors__ImageSharp
src/ImageSharp/Formats/Webp/Lossy/Vp8CostArray.cs
{ "start": 130, "end": 373 }
internal class ____ { /// <summary> /// Initializes a new instance of the <see cref="Vp8CostArray"/> class. /// </summary> public Vp8CostArray() => this.Costs = new ushort[67 + 1]; public ushort[] Costs { get; } }
Vp8CostArray
csharp
unoplatform__uno
src/Uno.UI.Tests/Windows_UI_Xaml_Data/xBindTests/Controls/XBind_ResourceDictionary.xaml.cs
{ "start": 514, "end": 650 }
partial class ____ : ResourceDictionary { public XBind_ResourceDictionary() { this.InitializeComponent(); } }
XBind_ResourceDictionary
csharp
dotnet__orleans
src/api/Orleans.Transactions/Orleans.Transactions.cs
{ "start": 130248, "end": 132332 }
partial class ____ : global::Orleans.TransactionTaskRequest { public string arg0; public System.Guid arg1; public System.DateTime arg2; public global::Orleans.Transactions.ParticipantId arg3; public global::Orleans.Transactions.TransactionalStatus arg4; public Invokable_ITransactionManagerExtension_GrainReference_Ext_12BEFA17(global::Orleans.Serialization.Serializer<global::Orleans.Transactions.OrleansTransactionAbortedException> base0, System.IServiceProvider base1) : base(default(Serialization.Serializer<Transactions.OrleansTransactionAbortedException>)!, default!) { } public override void Dispose() { } public override string GetActivityName() { throw null; } public override object GetArgument(int index) { throw null; } public override int GetArgumentCount() { throw null; } public override string GetInterfaceName() { throw null; } public override System.Type GetInterfaceType() { throw null; } public override System.Reflection.MethodInfo GetMethod() { throw null; } public override string GetMethodName() { throw null; } public override object GetTarget() { throw null; } protected override System.Threading.Tasks.Task InvokeInner() { throw null; } public override void SetArgument(int index, object value) { } public override void SetTarget(global::Orleans.Serialization.Invocation.ITargetHolder holder) { } } [System.CodeDom.Compiler.GeneratedCode("OrleansCodeGen", "9.0.0.0")] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::Orleans.CompoundTypeAlias(new[] { "inv", typeof(global::Orleans.Runtime.GrainReference), "Ext", typeof(global::Orleans.Transactions.Abstractions.ITransactionManagerExtension), typeof(global::Orleans.Transactions.Abstractions.ITransactionManagerExtension), "AC4A9AEB" })] public sealed
Invokable_ITransactionManagerExtension_GrainReference_Ext_12BEFA17
csharp
dotnet__orleans
src/Azure/Orleans.Clustering.AzureStorage/Options/AzureStorageGatewayOptions.cs
{ "start": 326, "end": 846 }
public class ____ : AzureStorageOperationOptionsValidator<AzureStorageGatewayOptions> { /// <summary> /// Initializes a new instance of the <see cref="AzureStorageGatewayOptionsValidator"/> class. /// </summary> /// <param name="options">The option to be validated.</param> /// <param name="name">The option name to be validated.</param> public AzureStorageGatewayOptionsValidator(AzureStorageGatewayOptions options, string name) : base(options, name) { } }
AzureStorageGatewayOptionsValidator
csharp
MiniProfiler__dotnet
tests/MiniProfiler.Tests.AspNet/Storage/TestHttpRuntimeCacheStorage.cs
{ "start": 142, "end": 2161 }
public class ____ { private MiniProfilerOptions Options { get; } public TestMemoryCacheStorage() { Options = new MiniProfilerOptions() { Storage = new MemoryCacheStorage(new TimeSpan(1, 0, 0)) }; } [Fact(WindowsOnly = true)] public void TestWeCanSaveTheSameProfilerTwice() { var profiler = new MiniProfiler("/", Options) { Started = DateTime.UtcNow, Id = Guid.NewGuid() }; Options.Storage.Save(profiler); Options.Storage.Save(profiler); var guids = Options.Storage.List(100).ToArray(); Assert.Equal(profiler.Id, guids[0]); Assert.Single(guids); } [Fact(WindowsOnly = true)] public void TestRangeQueries() { var now = DateTime.UtcNow; var inASec = now.AddSeconds(1); var in2Secs = now.AddSeconds(2); var in3Secs = now.AddSeconds(3); var profiler = new MiniProfiler("/", Options) { Started = now, Id = Guid.NewGuid() }; var profiler1 = new MiniProfiler("/", Options) { Started = inASec, Id = Guid.NewGuid() }; var profiler2 = new MiniProfiler("/", Options) { Started = in2Secs, Id = Guid.NewGuid() }; var profiler3 = new MiniProfiler("/", Options) { Started = in3Secs, Id = Guid.NewGuid() }; Options.Storage.Save(profiler); Options.Storage.Save(profiler3); Options.Storage.Save(profiler2); Options.Storage.Save(profiler1); var guids = Options.Storage.List(100); Assert.Equal(4, guids.Count()); guids = Options.Storage.List(1); Assert.Single(guids); guids = Options.Storage.List(2, now, in2Secs); Assert.Equal(profiler2.Id, guids.First()); Assert.Equal(profiler1.Id, guids.Skip(1).First()); Assert.Equal(2, guids.Count()); } } }
TestMemoryCacheStorage
csharp
files-community__Files
src/Files.App/Data/Items/FileTagItem.cs
{ "start": 277, "end": 1391 }
partial class ____ : ObservableObject, INavigationControlItem { public string Text { get; set; } private string path; public string Path { get => path; set { path = value; OnPropertyChanged(nameof(IconSource)); OnPropertyChanged(nameof(ToolTip)); } } public string ToolTipText { get; private set; } public SectionType Section { get; set; } public ContextMenuOptions MenuOptions { get; set; } public NavigationControlItemType ItemType => NavigationControlItemType.FileTag; public int CompareTo(INavigationControlItem other) => Text.CompareTo(other.Text); public TagViewModel FileTag { get; set; } public object? Children => null; public IconSource? IconSource { get => new PathIconSource() { Data = (Geometry)XamlBindingHelper.ConvertValue(typeof(Geometry), (string)Application.Current.Resources["App.Theme.PathIcon.FilledTag"]), Foreground = new SolidColorBrush(FileTag.Color.ToColor()) }; } public object ToolTip => Text; public bool IsExpanded { get => false; set { } } public bool PaddedItem => false; } }
FileTagItem
csharp
microsoft__semantic-kernel
dotnet/src/SemanticKernel.Abstractions/Memory/IMemoryStore.cs
{ "start": 4594, "end": 5092 }
record ____ found, otherwise null.</returns> Task<MemoryRecord?> GetAsync(string collectionName, string key, bool withEmbedding = false, CancellationToken cancellationToken = default); /// <summary> /// Gets a batch of memory records from the data store. Does not guarantee that the collection exists. /// </summary> /// <param name="collectionName">The name associated with a collection of embedding.</param> /// <param name="keys">The unique ids associated with the memory
if
csharp
jellyfin__jellyfin
Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs
{ "start": 148, "end": 387 }
public class ____ : StreamingRequestDto { /// <summary> /// Gets or sets a value indicating whether enable adaptive bitrate streaming. /// </summary> public bool EnableAdaptiveBitrateStreaming { get; set; } }
HlsAudioRequestDto
csharp
louthy__language-ext
LanguageExt.Core/Class Instances/Eq/EqTask.cs
{ "start": 147, "end": 377 }
public struct ____<A> : Eq<Task<A>> { [Pure] public static bool Equals(Task<A> x, Task<A> y) => x.Id == y.Id; [Pure] public static int GetHashCode(Task<A> x) => HashableTask<A>.GetHashCode(x); }
EqTask
csharp
unoplatform__uno
src/Uno.UI.Toolkit/ViewHelper.cs
{ "start": 151, "end": 243 }
public static class ____ { public static string Architecture => null; } } #endif
ViewHelper
csharp
xunit__xunit
src/xunit.v3.common.tests/Serialization/SerializationHelperTests.cs
{ "start": 33456, "end": 33875 }
interface ____<T> : IFormattable, IParsable<T> where T : IParsable<T> { public string Value { get; } static T IParsable<T>.Parse( string s, IFormatProvider? provider) { if (!T.TryParse(s, provider, out var result)) throw new InvalidOperationException(); return result; } string IFormattable.ToString( string? format, IFormatProvider? formatProvider) => Value; }
IParsableWrapper
csharp
dotnetcore__FreeSql
FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider2`16.cs
{ "start": 266670, "end": 305687 }
class ____ T10 : class { public Select10Provider(IFreeSql orm, CommonUtils commonUtils, CommonExpression commonExpression, object dywhere) : base(orm, commonUtils, commonExpression, dywhere) { if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(typeof(T2),typeof(T3),typeof(T4),typeof(T5),typeof(T6),typeof(T7),typeof(T8),typeof(T9),typeof(T10)); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T2)), Alias = $"SP10b", On = null, Type = SelectTableInfoType.From }); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T3)), Alias = $"SP10c", On = null, Type = SelectTableInfoType.From }); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T4)), Alias = $"SP10d", On = null, Type = SelectTableInfoType.From }); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T5)), Alias = $"SP10e", On = null, Type = SelectTableInfoType.From }); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T6)), Alias = $"SP10f", On = null, Type = SelectTableInfoType.From }); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T7)), Alias = $"SP10g", On = null, Type = SelectTableInfoType.From }); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T8)), Alias = $"SP10h", On = null, Type = SelectTableInfoType.From }); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T9)), Alias = $"SP10i", On = null, Type = SelectTableInfoType.From }); _tables.Add(new SelectTableInfo { Table = _commonUtils.GetTableByEntity(typeof(T10)), Alias = $"SP10j", On = null, Type = SelectTableInfoType.From }); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.WithSql(string sqlT1,string sqlT2,string sqlT3,string sqlT4,string sqlT5,string sqlT6,string sqlT7,string sqlT8,string sqlT9,string sqlT10, object parms) { this.AsTable((type, old) => { if (type == _tables[0].Table?.Type && string.IsNullOrEmpty(sqlT1) == false) return $"({sqlT1})"; if (type == _tables[1].Table?.Type && string.IsNullOrEmpty(sqlT2) == false) return $"({sqlT2})"; if (type == _tables[2].Table?.Type && string.IsNullOrEmpty(sqlT3) == false) return $"({sqlT3})"; if (type == _tables[3].Table?.Type && string.IsNullOrEmpty(sqlT4) == false) return $"({sqlT4})"; if (type == _tables[4].Table?.Type && string.IsNullOrEmpty(sqlT5) == false) return $"({sqlT5})"; if (type == _tables[5].Table?.Type && string.IsNullOrEmpty(sqlT6) == false) return $"({sqlT6})"; if (type == _tables[6].Table?.Type && string.IsNullOrEmpty(sqlT7) == false) return $"({sqlT7})"; if (type == _tables[7].Table?.Type && string.IsNullOrEmpty(sqlT8) == false) return $"({sqlT8})"; if (type == _tables[8].Table?.Type && string.IsNullOrEmpty(sqlT9) == false) return $"({sqlT9})"; if (type == _tables[9].Table?.Type && string.IsNullOrEmpty(sqlT10) == false) return $"({sqlT10})"; return old; }); if (parms != null) _params.AddRange(_commonUtils.GetDbParamtersByObject($"{sqlT1};\r\n{sqlT2};\r\n{sqlT3};\r\n{sqlT4};\r\n{sqlT5};\r\n{sqlT6};\r\n{sqlT7};\r\n{sqlT8};\r\n{sqlT9};\r\n{sqlT10}", parms)); return this; } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.As(string aliasT1,string aliasT2,string aliasT3,string aliasT4,string aliasT5,string aliasT6,string aliasT7,string aliasT8,string aliasT9,string aliasT10) { if (string.IsNullOrEmpty(aliasT1) == false) _tables[0].Alias = aliasT1; if (string.IsNullOrEmpty(aliasT2) == false) _tables[1].Alias = aliasT2; if (string.IsNullOrEmpty(aliasT3) == false) _tables[2].Alias = aliasT3; if (string.IsNullOrEmpty(aliasT4) == false) _tables[3].Alias = aliasT4; if (string.IsNullOrEmpty(aliasT5) == false) _tables[4].Alias = aliasT5; if (string.IsNullOrEmpty(aliasT6) == false) _tables[5].Alias = aliasT6; if (string.IsNullOrEmpty(aliasT7) == false) _tables[6].Alias = aliasT7; if (string.IsNullOrEmpty(aliasT8) == false) _tables[7].Alias = aliasT8; if (string.IsNullOrEmpty(aliasT9) == false) _tables[8].Alias = aliasT9; if (string.IsNullOrEmpty(aliasT10) == false) _tables[9].Alias = aliasT10; return this; } ISelect<TDto> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.WithTempQuery<TDto>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TDto>> selector) { for (var a = 0; a < selector.Parameters.Count; a++) _tables[a].Parameter = selector.Parameters[a]; return this.InternalWithTempQuery<TDto>(selector); } double ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Avg<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column) { if (column == null) return default(double); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalAvg(column?.Body); } ISelectGrouping<TKey, NativeTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.GroupBy<TKey>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TKey>> exp) { if (exp == null) return this.InternalGroupBy<TKey, NativeTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>>(exp?.Body); for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a]; return this.InternalGroupBy<TKey, NativeTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>>(exp?.Body); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.GroupBySelf<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column) { if (column == null) this.InternalGroupBySelf(column?.Body); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalGroupBySelf(column?.Body); } TMember ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Max<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column) { if (column == null) return default(TMember); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalMax<TMember>(column?.Body); } TMember ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Min<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column) { if (column == null) return default(TMember); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalMin<TMember>(column?.Body); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.OrderBy<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column) { if (column == null) this.InternalOrderBy(column?.Body); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalOrderBy(column?.Body); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.OrderByDescending<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column) { if (column == null) this.InternalOrderBy(column?.Body); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalOrderByDescending(column?.Body); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.OrderByIf<TMember>(bool condition, Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column, bool descending) { if (condition == false || column == null) return this; for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return descending ? this.InternalOrderByDescending(column?.Body) : this.InternalOrderBy(column?.Body); } decimal ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Sum<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column) { if (column == null) this.InternalOrderBy(column?.Body); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalSum(column?.Body); } TReturn ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToAggregate<TReturn>(Expression<Func<ISelectGroupingAggregate<T1>,ISelectGroupingAggregate<T2>,ISelectGroupingAggregate<T3>,ISelectGroupingAggregate<T4>,ISelectGroupingAggregate<T5>,ISelectGroupingAggregate<T6>,ISelectGroupingAggregate<T7>,ISelectGroupingAggregate<T8>,ISelectGroupingAggregate<T9>,ISelectGroupingAggregate<T10>, TReturn>> select) { if (select == null) return default(TReturn); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalToAggregate<TReturn>(select?.Body); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Aggregate<TReturn>(Expression<Func<ISelectGroupingAggregate<T1>,ISelectGroupingAggregate<T2>,ISelectGroupingAggregate<T3>,ISelectGroupingAggregate<T4>,ISelectGroupingAggregate<T5>,ISelectGroupingAggregate<T6>,ISelectGroupingAggregate<T7>,ISelectGroupingAggregate<T8>,ISelectGroupingAggregate<T9>,ISelectGroupingAggregate<T10>, TReturn>> select, out TReturn result) { result = (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToAggregate(select); return this; } List<TReturn> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToList<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select) { if (select == null) return this.InternalToList<TReturn>(select?.Body); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalToList<TReturn>(select?.Body); } List<TDto> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToList<TDto>() => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToList(GetToListDtoSelector<TDto>()); Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TDto>> GetToListDtoSelector<TDto>() { return Expression.Lambda<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TDto>>( typeof(TDto).InternalNewExpression(), _tables[0].Parameter ?? Expression.Parameter(typeof(T1), "a"),Expression.Parameter(typeof(T2), "b"),Expression.Parameter(typeof(T3), "c"),Expression.Parameter(typeof(T4), "d"),Expression.Parameter(typeof(T5), "e"),Expression.Parameter(typeof(T6), "f"),Expression.Parameter(typeof(T7), "g"),Expression.Parameter(typeof(T8), "h"),Expression.Parameter(typeof(T9), "i"),Expression.Parameter(typeof(T10), "j")); } public void ToChunk<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select, int size, Action<FetchCallbackArgs<List<TReturn>>> done) { if (select == null || done == null) return; for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; this.InternalToChunk<TReturn>(select.Body, size, done); } DataTable ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToDataTable<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select) { if (select == null) return this.InternalToDataTable(select?.Body); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalToDataTable(select?.Body); } int ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.InsertInto<TTargetEntity>(string tableName, Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TTargetEntity>> select) { if (select == null) return this.InternalInsertInto<TTargetEntity>(tableName, select); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalInsertInto<TTargetEntity>(tableName, select?.Body); } string ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToSql<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select, FieldAliasOptions fieldAlias) { if (select == null) return this.InternalToSql<TReturn>(select?.Body, fieldAlias); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalToSql<TReturn>(select?.Body, fieldAlias); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.LeftJoin(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>> exp) { if (exp == null) return this.InternalJoin(exp?.Body, SelectTableInfoType.LeftJoin); for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a]; return this.InternalJoin(exp?.Body, SelectTableInfoType.LeftJoin); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Join(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>> exp) => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).InnerJoin(exp); ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.InnerJoin(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>> exp) { if (exp == null) return this.InternalJoin(exp?.Body, SelectTableInfoType.LeftJoin); for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a]; return this.InternalJoin(exp?.Body, SelectTableInfoType.InnerJoin); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.RightJoin(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>> exp) { if (exp == null) return this.InternalJoin(exp?.Body, SelectTableInfoType.LeftJoin); for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a]; return this.InternalJoin(exp?.Body, SelectTableInfoType.RightJoin); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Where(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>> exp) { if (exp == null) return this.Where(null); for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a]; return this.Where(_commonExpression.ExpressionWhereLambda(_tables, _tableRule, exp?.Body, _diymemexpWithTempQuery, _whereGlobalFilter, _params)); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.WhereIf(bool condition, Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>> exp) { if (condition == false || exp == null) return this; for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a]; return this.Where(_commonExpression.ExpressionWhereLambda(_tables, _tableRule, exp?.Body, _diymemexpWithTempQuery, _whereGlobalFilter, _params)); } bool ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Any(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>> exp) { if (exp == null) return this.Any(); for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a]; var oldwhere = _where.ToString(); var ret = this.Where(_commonExpression.ExpressionWhereLambda(_tables, _tableRule, exp?.Body, _diymemexpWithTempQuery, _whereGlobalFilter, _params)).Any(); _where.Clear().Append(oldwhere); return ret; } TReturn ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToOne<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select) => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToList(select).FirstOrDefault(); TReturn ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.First<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select) => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToList(select).FirstOrDefault(); TDto ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.First<TDto>() => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToList<TDto>().FirstOrDefault(); #region HzyTuple 元组 ISelect<TDto> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.WithTempQuery<TDto>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TDto>> selector) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(selector, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).WithTempQuery<TDto>((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TDto>>)expModify); } double ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Avg<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Avg((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify); } ISelectGrouping<TKey, NativeTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.GroupBy<TKey>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TKey>> exp) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(exp, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).GroupBy((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TKey>>)expModify); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.GroupBySelf<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).GroupBySelf((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify); } TMember ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Max<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Max((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify); } TMember ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Min<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Min((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.OrderBy<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).OrderBy((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.OrderByDescending<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).OrderByDescending((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.OrderByIf<TMember>(bool condition, Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column, bool descending) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).OrderByIf(condition, (Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify,descending); } decimal ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Sum<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Sum((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify); } List<TReturn> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToList<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToList((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>>)expModify); } public void ToChunk<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select, int size, Action<FetchCallbackArgs<List<TReturn>>> done) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToChunk((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>>)expModify,size,done); } DataTable ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToDataTable<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToDataTable((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>>)expModify); } int ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.InsertInto<TTargetEntity>(string tableName, Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TTargetEntity>> select) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).InsertInto(tableName,(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TTargetEntity>>)expModify); } string ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToSql<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select, FieldAliasOptions fieldAlias) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToSql((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>>)expModify,fieldAlias); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.LeftJoin(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, bool>> exp) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(exp, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).LeftJoin((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>>)expModify); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Join(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, bool>> exp) => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).InnerJoin(exp); ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.InnerJoin(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, bool>> exp) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(exp, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).InnerJoin((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>>)expModify); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.RightJoin(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, bool>> exp) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(exp, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).RightJoin((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>>)expModify); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Where(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, bool>> exp) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(exp, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Where((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>>)expModify); } ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.WhereIf(bool condition, Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, bool>> exp) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(exp, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).WhereIf(condition, (Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>>)expModify); } bool ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.Any(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, bool>> exp) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(exp, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Any((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>>)expModify); } TReturn ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToOne<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select) => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToList(select).FirstOrDefault(); TReturn ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.First<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select) => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToList(select).FirstOrDefault(); #endregion #if net40 #else Task<double> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.AvgAsync<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column, CancellationToken cancellationToken) { if (column == null) return Task.FromResult(default(double)); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalAvgAsync(column?.Body, cancellationToken); } Task<TMember> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.MaxAsync<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column, CancellationToken cancellationToken) { if (column == null) return Task.FromResult(default(TMember)); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalMaxAsync<TMember>(column?.Body, cancellationToken); } Task<TMember> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.MinAsync<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column, CancellationToken cancellationToken) { if (column == null) return Task.FromResult(default(TMember)); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalMinAsync<TMember>(column?.Body, cancellationToken); } Task<decimal> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.SumAsync<TMember>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>> column, CancellationToken cancellationToken) { if (column == null) this.InternalOrderBy(column?.Body); for (var a = 0; a < column.Parameters.Count; a++) _tables[a].Parameter = column.Parameters[a]; return this.InternalSumAsync(column?.Body, cancellationToken); } Task<TReturn> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToAggregateAsync<TReturn>(Expression<Func<ISelectGroupingAggregate<T1>,ISelectGroupingAggregate<T2>,ISelectGroupingAggregate<T3>,ISelectGroupingAggregate<T4>,ISelectGroupingAggregate<T5>,ISelectGroupingAggregate<T6>,ISelectGroupingAggregate<T7>,ISelectGroupingAggregate<T8>,ISelectGroupingAggregate<T9>,ISelectGroupingAggregate<T10>, TReturn>> select, CancellationToken cancellationToken) { if (select == null) return Task.FromResult(default(TReturn)); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalToAggregateAsync<TReturn>(select?.Body, cancellationToken); } Task<List<TReturn>> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToListAsync<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select, CancellationToken cancellationToken) { if (select == null) return this.InternalToListAsync<TReturn>(select?.Body, cancellationToken); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalToListAsync<TReturn>(select?.Body, cancellationToken); } Task<List<TDto>> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToListAsync<TDto>(CancellationToken cancellationToken) => (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToListAsync(GetToListDtoSelector<TDto>(), cancellationToken); async Task ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToChunkAsync<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select, int size, Func<FetchCallbackArgs<List<TReturn>>, Task> done, CancellationToken cancellationToken) { if (select == null || done == null) return; for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; await this.InternalToChunkAsync<TReturn>(select.Body, size, done, cancellationToken); } Task<DataTable> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToDataTableAsync<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select, CancellationToken cancellationToken) { if (select == null) return this.InternalToDataTableAsync(select?.Body, cancellationToken); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalToDataTableAsync(select?.Body, cancellationToken); } Task<int> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TTargetEntity>> select, CancellationToken cancellationToken) { if (select == null) return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select, cancellationToken); for (var a = 0; a < select.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalInsertIntoAsync<TTargetEntity>(tableName, select?.Body, cancellationToken); } async Task<bool> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.AnyAsync(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>> exp, CancellationToken cancellationToken) { if (exp == null) return await this.AnyAsync(); for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a]; var oldwhere = _where.ToString(); var ret = await this.Where(_commonExpression.ExpressionWhereLambda(_tables, _tableRule, exp?.Body, _diymemexpWithTempQuery, _whereGlobalFilter, _params)).AnyAsync(cancellationToken); _where.Clear().Append(oldwhere); return ret; } async Task<TReturn> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToOneAsync<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select, CancellationToken cancellationToken) => (await (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToListAsync(select, cancellationToken)).FirstOrDefault(); async Task<TReturn> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.FirstAsync<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select, CancellationToken cancellationToken) => (await (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToListAsync(select, cancellationToken)).FirstOrDefault(); async Task<TDto> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.FirstAsync<TDto>(CancellationToken cancellationToken) => (await (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToListAsync<TDto>(cancellationToken)).FirstOrDefault(); #region HzyTuple 元组 Task<double> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.AvgAsync<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).AvgAsync((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify, cancellationToken); } Task<TMember> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.MaxAsync<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).MaxAsync((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify, cancellationToken); } Task<TMember> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.MinAsync<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).MinAsync((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify, cancellationToken); } Task<decimal> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.SumAsync<TMember>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TMember>> column, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(column, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).SumAsync((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TMember>>)expModify, cancellationToken); } Task<List<TReturn>> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToListAsync<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToListAsync((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>>)expModify, cancellationToken); } Task ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToChunkAsync<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select, int size, Func<FetchCallbackArgs<List<TReturn>>, Task> done, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToChunkAsync((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>>)expModify, size, done, cancellationToken); } Task<DataTable> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToDataTableAsync<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).ToDataTableAsync((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>>)expModify, cancellationToken); } Task<int> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.InsertIntoAsync<TTargetEntity>(string tableName, Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TTargetEntity>> select, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(select, _tables); return (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).InsertIntoAsync(tableName,(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TTargetEntity>>)expModify, cancellationToken); } async Task<bool> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.AnyAsync(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, bool>> exp, CancellationToken cancellationToken) { var expModify = new CommonExpression.ReplaceHzyTupleToMultiParam().Modify(exp, _tables); return await (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).AnyAsync((Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, bool>>)expModify, cancellationToken); } async Task<TReturn> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.ToOneAsync<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select, CancellationToken cancellationToken) => (await (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToListAsync(select, cancellationToken)).FirstOrDefault(); async Task<TReturn> ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>.FirstAsync<TReturn>(Expression<Func<HzyTuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>, TReturn>> select, CancellationToken cancellationToken) => (await (this as ISelect<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>).Limit(1).ToListAsync(select, cancellationToken)).FirstOrDefault(); #endregion #endif #if ns21 public IAsyncEnumerable<List<TReturn>> ToChunkAsyncEnumerable<TReturn>(Expression<Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10, TReturn>> select, int size) { for (var a = 0; a < select?.Parameters.Count; a++) _tables[a].Parameter = select.Parameters[a]; return this.InternalToChunkAsyncEnumerable<TReturn>(select?.Body, size); } #endif }
where
csharp
dotnet__orleans
src/Orleans.Connections.Security/Hosting/HostingExtensions.IClientBuilder.cs
{ "start": 178, "end": 5077 }
partial class ____ { /// <summary> /// Configures TLS. /// </summary> /// <param name="builder">The builder to configure.</param> /// <param name="storeName">The certificate store to load the certificate from.</param> /// <param name="subject">The subject name for the certificate to load.</param> /// <param name="allowInvalid">Indicates if invalid certificates should be considered, such as self-signed certificates.</param> /// <param name="location">The store location to load the certificate from.</param> /// <param name="configureOptions">An Action to configure the <see cref="TlsOptions"/>.</param> /// <returns>The builder.</returns> public static IClientBuilder UseTls( this IClientBuilder builder, StoreName storeName, string subject, bool allowInvalid, StoreLocation location, Action<TlsOptions> configureOptions) { if (configureOptions is null) { throw new ArgumentNullException(nameof(configureOptions)); } return builder.UseTls( CertificateLoader.LoadFromStoreCert(subject, storeName.ToString(), location, allowInvalid, server: false), configureOptions); } /// <summary> /// Configures TLS. /// </summary> /// <param name="builder">The builder to configure.</param> /// <param name="certificate">The server certificate.</param> /// <param name="configureOptions">An Action to configure the <see cref="TlsOptions"/>.</param> /// <returns>The builder.</returns> public static IClientBuilder UseTls( this IClientBuilder builder, X509Certificate2 certificate, Action<TlsOptions> configureOptions) { if (certificate is null) { throw new ArgumentNullException(nameof(certificate)); } if (configureOptions is null) { throw new ArgumentNullException(nameof(configureOptions)); } if (!certificate.HasPrivateKey) { TlsConnectionBuilderExtensions.ThrowNoPrivateKey(certificate, nameof(certificate)); } return builder.UseTls(options => { options.LocalCertificate = certificate; configureOptions(options); }); } /// <summary> /// Configures TLS. /// </summary> /// <param name="builder">The builder to configure.</param> /// <param name="certificate">The server certificate.</param> /// <returns>The builder.</returns> public static IClientBuilder UseTls( this IClientBuilder builder, X509Certificate2 certificate) { if (certificate is null) { throw new ArgumentNullException(nameof(certificate)); } if (!certificate.HasPrivateKey) { TlsConnectionBuilderExtensions.ThrowNoPrivateKey(certificate, nameof(certificate)); } return builder.UseTls(options => { options.LocalCertificate = certificate; }); } /// <summary> /// Configures TLS. /// </summary> /// <param name="builder">The builder to configure.</param> /// <param name="configureOptions">An Action to configure the <see cref="TlsOptions"/>.</param> /// <returns>The builder.</returns> public static IClientBuilder UseTls( this IClientBuilder builder, Action<TlsOptions> configureOptions) { if (configureOptions is null) { throw new ArgumentNullException(nameof(configureOptions)); } var options = new TlsOptions(); configureOptions(options); if (options.LocalCertificate is null && options.ClientCertificateMode == RemoteCertificateMode.RequireCertificate) { throw new InvalidOperationException("No certificate specified"); } if (options.LocalCertificate is X509Certificate2 certificate && !certificate.HasPrivateKey) { TlsConnectionBuilderExtensions.ThrowNoPrivateKey(certificate, $"{nameof(TlsOptions)}.{nameof(TlsOptions.LocalCertificate)}"); } return builder.Configure<ClientConnectionOptions>(connectionOptions => { connectionOptions.ConfigureConnection(connectionBuilder => { connectionBuilder.UseClientTls(options); }); }); } } }
OrleansConnectionSecurityHostingExtensions
csharp
FastEndpoints__FastEndpoints
Src/Library/Messaging/Jobs/JobTracker.cs
{ "start": 459, "end": 2697 }
record ____ also be marked complete via <see cref="IJobStorageProvider{TStorageRecord}.CancelJobAsync" /> method of the job storage /// provider, which will prevent the job from being picked up for execution. /// </summary> /// <param name="trackingId">the job tracking id</param> /// <param name="ct">optional cancellation token</param> /// <exception cref="Exception"> /// this method will throw any exceptions that the job storage provider may throw in case of transient errors. you can safely retry calling this /// method repeatedly with the same tracking id. /// </exception> public Task CancelJobAsync(Guid trackingId, CancellationToken ct = default) => JobQueueBase.CancelJobAsync<TCommand>(trackingId, ct); /// <summary> /// this method can be used to either store a preliminary job result and/or job progress before the job execution fully completes. /// </summary> /// <param name="trackingId">the job tracking id</param> /// <param name="result">the preliminary job result or progress to store</param> /// <param name="ct">cancellation token</param> /// <typeparam name="TResult">the type of the preliminary result or progress</typeparam> public Task StoreJobResultAsync<TResult>(Guid trackingId, TResult result, CancellationToken ct = default) where TResult : IJobResult => JobQueueBase.StoreJobResultAsync<TCommand, TResult>(trackingId, result, ct); /// <summary> /// retrieve the result of a command (that returns a result) which was previously queued as a job. /// the returned result will be null/default until the job is actually complete. /// </summary> /// <param name="trackingId">the job tracking id</param> /// <param name="ct">cancellation token</param> /// <typeparam name="TResult">the type of the expected result</typeparam> public Task<TResult?> GetJobResultAsync<TResult>(Guid trackingId, CancellationToken ct = default) => JobQueueBase.GetJobResultAsync<TCommand, TResult>(trackingId, ct); } /// <summary> /// a <see cref="IJobTracker{TCommand}" /> implementation used for tracking queued jobs /// </summary> /// <typeparam name="TCommand">the command type of the job</typeparam>
will
csharp
ServiceStack__ServiceStack
ServiceStack/tests/ServiceStack.WebHost.Endpoints.Tests/DeclarativeValidationTests.cs
{ "start": 2236, "end": 2436 }
public class ____ : AbstractValidator<FluentChildValidation> { public FluentChildValidationValidator() { RuleFor(x => x.Value).MaximumLength(20); } } //
FluentChildValidationValidator
csharp
abpframework__abp
modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/GlobalSettingManagerExtensions.cs
{ "start": 159, "end": 939 }
public static class ____ { public static Task<string> GetOrNullGlobalAsync(this ISettingManager settingManager, [NotNull] string name, bool fallback = true) { return settingManager.GetOrNullAsync(name, GlobalSettingValueProvider.ProviderName, null, fallback); } public static Task<List<SettingValue>> GetAllGlobalAsync(this ISettingManager settingManager, bool fallback = true) { return settingManager.GetAllAsync(GlobalSettingValueProvider.ProviderName, null, fallback); } public static Task SetGlobalAsync(this ISettingManager settingManager, [NotNull] string name, [CanBeNull] string value) { return settingManager.SetAsync(name, value, GlobalSettingValueProvider.ProviderName, null); } }
GlobalSettingManagerExtensions
csharp
OrchardCMS__OrchardCore
src/OrchardCore.Modules/OrchardCore.Contents/AuditTrail/Startup.cs
{ "start": 774, "end": 1695 }
public sealed class ____ : StartupBase { public override void ConfigureServices(IServiceCollection services) { services.AddDataMigration<Migrations>(); services.AddContentPart<AuditTrailPart>() .UseDisplayDriver<AuditTrailPartDisplayDriver>(); services.AddScoped<IContentTypePartDefinitionDisplayDriver, AuditTrailPartSettingsDisplayDriver>(); services.AddScoped<IContentDisplayDriver, AuditTrailContentsDriver>(); services.AddTransient<IConfigureOptions<AuditTrailOptions>, ContentAuditTrailEventConfiguration>(); services.AddScoped<IAuditTrailEventHandler, ContentAuditTrailEventHandler>(); services.AddSiteDisplayDriver<ContentAuditTrailSettingsDisplayDriver>(); services.AddDisplayDriver<AuditTrailEvent, AuditTrailContentEventDisplayDriver>(); services.AddScoped<IContentHandler, AuditTrailContentHandler>(); } }
Startup
csharp
getsentry__sentry-dotnet
src/Sentry/Protocol/Metrics/MetricResourceIdentifier.cs
{ "start": 209, "end": 553 }
internal record ____ MetricResourceIdentifier(MetricType MetricType, string Key, MeasurementUnit Unit) { /// <summary> /// Returns a string representation of the metric resource identifier. /// </summary> public override string ToString() => $"{MetricType.ToStatsdType()}:{MetricHelper.SanitizeTagKey(Key)}@{Unit}"; }
struct
csharp
abpframework__abp
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Data/MyProjectNameDbContextFactory.cs
{ "start": 127, "end": 1158 }
public class ____ : IDesignTimeDbContextFactory<MyProjectNameDbContext> { public MyProjectNameDbContext CreateDbContext(string[] args) { //<TEMPLATE-REMOVE IF-NOT='dbms:PostgreSQL'> // https://www.npgsql.org/efcore/release-notes/6.0.html#opting-out-of-the-new-timestamp-mapping-logic AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); //</TEMPLATE-REMOVE> MyProjectNameEfCoreEntityExtensionMappings.Configure(); var configuration = BuildConfiguration(); var builder = new DbContextOptionsBuilder<MyProjectNameDbContext>() .UseSqlServer(configuration.GetConnectionString("Default")); return new MyProjectNameDbContext(builder.Options); } private static IConfigurationRoot BuildConfiguration() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false); return builder.Build(); } }
MyProjectNameDbContextFactory
csharp
dotnet__aspnetcore
src/Http/Http.Extensions/test/ParameterBindingMethodCacheTests.cs
{ "start": 34660, "end": 35126 }
private record ____ TryParseStringStruct(int Value) { public static bool TryParse(string? value, IFormatProvider formatProvider, out TryParseStringStruct result) { if (!int.TryParse(value, NumberStyles.Integer, formatProvider, out var val)) { result = default; return false; } result = new TryParseStringStruct(val); return true; } }
struct
csharp
microsoft__semantic-kernel
dotnet/src/VectorData/SqliteVec/Conditions/SqliteWhereInCondition.cs
{ "start": 144, "end": 619 }
internal sealed class ____(string operand, List<object> values) : SqliteWhereCondition(operand, values) { public override string BuildQuery(List<string> parameterNames) { const string InOperator = "IN"; Verify.True(parameterNames.Count > 0, $"Cannot build '{nameof(SqliteWhereInCondition)}' condition without parameter names."); return $"{this.GetOperand()} {InOperator} ({string.Join(", ", parameterNames)})"; } }
SqliteWhereInCondition
csharp
EventStore__EventStore
src/KurrentDB.Core/TransactionLog/Chunks/TFChunk/TFChunkReadSide.cs
{ "start": 5418, "end": 10002 }
private class ____ : TFChunkReadSide, IChunkReadSide { // must hold _lock to assign to _midpoints private readonly AsyncExclusiveLock _lock = new(); private Midpoint[] _midpoints; public TFChunkReadSideScavenged(TFChunk chunk, ITransactionFileTracker tracker) : base(chunk, tracker) { if (!chunk._chunkHeader.IsScavenged) throw new ArgumentException($"Chunk provided is not scavenged: {chunk}"); } private async ValueTask<Midpoint[]> GetOrCreateMidPoints(ReaderWorkItem workItem, CancellationToken token) { // double-checked lock pattern if (_midpoints is { } midpoints) return midpoints; await _lock.AcquireAsync(token); try { if (_midpoints is { } midpointsDouble) return midpointsDouble; _midpoints = await PopulateMidpoints(Chunk._midpointsDepth, workItem, token); return _midpoints; } finally { _lock.Release(); } } private async ValueTask<Midpoint[]> PopulateMidpoints(int depth, ReaderWorkItem workItem, CancellationToken token) { if (depth > 31) throw new ArgumentOutOfRangeException(nameof(depth), "Depth too for midpoints."); var mapCount = Chunk.ChunkFooter.MapCount; if (mapCount is 0) // empty chunk return []; var posmapSize = Chunk.ChunkFooter.IsMap12Bytes ? PosMap.FullSize : PosMap.DeprecatedSize; using var posMapTable = UnmanagedMemory.Allocate<byte>(posmapSize * mapCount); // write the table once workItem.BaseStream.Position = ChunkHeader.Size + Chunk.ChunkFooter.PhysicalDataSize; await workItem.BaseStream.ReadExactlyAsync(posMapTable.Memory, token); return CreateMidpoints(posMapTable.Span, depth, mapCount, posmapSize); static Midpoint[] CreateMidpoints(ReadOnlySpan<byte> posMapTable, int depth, int mapCount, int posmapSize) { int midPointsCnt = 1 << depth; int segmentSize; Midpoint[] midpoints; if (mapCount < midPointsCnt) { segmentSize = 1; // we cache all items midpoints = GC.AllocateUninitializedArray<Midpoint>(mapCount); } else { segmentSize = mapCount / midPointsCnt; midpoints = GC.AllocateUninitializedArray<Midpoint>(1 + (mapCount + segmentSize - 1) / segmentSize); } var i = 0; for (int x = 0, xN = mapCount - 1; x < xN; x += segmentSize, i++) { midpoints[i] = new(x, ReadPosMap(posMapTable, x, posmapSize)); } // add the very last item as the last midpoints (there can be 0, 1 or more of these) var lastMidpoint = new Midpoint(mapCount - 1, ReadPosMap(posMapTable, mapCount - 1, posmapSize)); while (i < midpoints.Length) { midpoints[i++] = lastMidpoint; } return midpoints; } } private static unsafe PosMap ReadPosMap(ReadOnlySpan<byte> table, int index, int posmapSize) { delegate*<ReadOnlySpan<byte>, PosMap> factory; if (posmapSize is PosMap.FullSize) { factory = &PosMap.FromNewFormat; } else { factory = &PosMap.FromOldFormat; } return factory(table.Slice(index * posmapSize, posmapSize)); } public async ValueTask<bool> ExistsAt(long logicalPosition, CancellationToken token) { var workItem = Chunk.GetReaderWorkItem(); try { var actualPosition = await TranslateExactPosition(workItem, logicalPosition, token); return actualPosition >= 0 && actualPosition < Chunk.PhysicalDataSize; } finally { Chunk.ReturnReaderWorkItem(workItem); } } public async ValueTask<long> GetActualPosition(long logicalPosition, CancellationToken token) { Ensure.Nonnegative(logicalPosition, nameof(logicalPosition)); var workItem = Chunk.GetReaderWorkItem(); try { return await TranslateExactPosition(workItem, logicalPosition, token); } finally { Chunk.ReturnReaderWorkItem(workItem); } } public async ValueTask<RecordReadResult> TryReadAt(long logicalPosition, bool couldBeScavenged, CancellationToken token) { var start = Instant.Now; var workItem = Chunk.GetReaderWorkItem(); try { var actualPosition = await TranslateExactPosition(workItem, logicalPosition, token); if (actualPosition is -1 || actualPosition >= Chunk.PhysicalDataSize) { if (!couldBeScavenged) { _log.Warning( "Tried to read actual position {actualPosition}, translated from logPosition {logicalPosition}, " + "which is greater than the chunk's physical size of {chunkPhysicalSize}", actualPosition, logicalPosition, Chunk.PhysicalDataSize); } return RecordReadResult.Failure; } var (record, length) = await TryReadForwardInternal(start, workItem, actualPosition, token); return new(
TFChunkReadSideScavenged
csharp
microsoft__PowerToys
src/dsc/v3/PowerToys.DSC/Models/ResourceObjects/BaseResourceObject.cs
{ "start": 473, "end": 1352 }
public class ____ { private readonly JsonSerializerOptions _options; public BaseResourceObject() { _options = new() { WriteIndented = false, TypeInfoResolver = new DefaultJsonTypeInfoResolver(), }; } /// <summary> /// Gets or sets whether an instance is in the desired state. /// </summary> [JsonPropertyName("_inDesiredState")] [Description("Indicates whether an instance is in the desired state")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public bool? InDesiredState { get; set; } /// <summary> /// Generates a JSON representation of the resource object. /// </summary> /// <returns></returns> public JsonNode ToJson() { return JsonSerializer.SerializeToNode(this, GetType(), _options) ?? new JsonObject(); } }
BaseResourceObject
csharp
dotnet__aspire
tests/Aspire.Azure.AI.Inference.Tests/AspireAzureAIInferencePublicApiTests.cs
{ "start": 232, "end": 2247 }
public class ____ { [Fact] public void AddChatCompletionsClientShouldThrowWhenBuilderIsNull() { IHostApplicationBuilder builder = null!; const string connectionName = "aiinference"; var action = () => builder.AddAzureChatCompletionsClient(connectionName); var exception = Assert.Throws<ArgumentNullException>(action); Assert.Equal(nameof(builder), exception.ParamName); } [Theory] [InlineData(true)] [InlineData(false)] public void AddChatCompletionsClientShouldThrowWhenConnectionNameIsNullOrEmpty(bool isNull) { var builder = Host.CreateEmptyApplicationBuilder(null); var connectionName = isNull ? null! : string.Empty; var action = () => builder.AddAzureChatCompletionsClient(connectionName); var exception = isNull ? Assert.Throws<ArgumentNullException>(action) : Assert.Throws<ArgumentException>(action); Assert.Equal(nameof(connectionName), exception.ParamName); } [Fact] public void AddKeyedChatCompletionsClientShouldThrowWhenBuilderIsNull() { IHostApplicationBuilder builder = null!; const string name = "aiinference"; var action = () => builder.AddKeyedAzureChatCompletionsClient(name); var exception = Assert.Throws<ArgumentNullException>(action); Assert.Equal(nameof(builder), exception.ParamName); } [Theory] [InlineData(true)] [InlineData(false)] public void AddKeyedChatCompletionsClientShouldThrowWhenNameIsNullOrEmpty(bool isNull) { var builder = Host.CreateEmptyApplicationBuilder(null); var name = isNull ? null! : string.Empty; var action = () => builder.AddKeyedAzureChatCompletionsClient(name); var exception = isNull ? Assert.Throws<ArgumentNullException>(action) : Assert.Throws<ArgumentException>(action); Assert.Equal(nameof(name), exception.ParamName); } }
AspireAzureAIInferencePublicApiTests
csharp
nunit__nunit
src/NUnitFramework/benchmarks/nunit.framework.benchmarks/CompositeWorkItemBenchmark.cs
{ "start": 2455, "end": 2785 }
internal sealed class ____ : IWorkItemDispatcher { public int LevelOfParallelism => 0; public void Start(WorkItem topLevelWorkItem) => topLevelWorkItem.Execute(); public void Dispatch(WorkItem work) => work.Execute(); public void CancelRun(bool force) => throw new NotImplementedException(); }
SuperSimpleDispatcher
csharp
icsharpcode__AvalonEdit
ICSharpCode.AvalonEdit/Rendering/ITextViewConnect.cs
{ "start": 1416, "end": 1696 }
public interface ____ { /// <summary> /// Called when added to a text view. /// </summary> void AddToTextView(TextView textView); /// <summary> /// Called when removed from a text view. /// </summary> void RemoveFromTextView(TextView textView); } }
ITextViewConnect
csharp
CommunityToolkit__Maui
samples/CommunityToolkit.Maui.Sample/Views/Popups/ImplicitStylePopup.xaml.cs
{ "start": 300, "end": 411 }
public partial class ____ : Popup { public ImplicitStylePopup() { InitializeComponent(); } }
ImplicitStylePopup
csharp
protobuf-net__protobuf-net
src/protobuf-net.Test/CustomScalarAllocator.cs
{ "start": 4942, "end": 5155 }
public class ____ { [ProtoMember(1)] public string Value { get; set; } } // this is a type that *uses* our custm scalar [ProtoContract]
HazRegularString
csharp
ServiceStack__ServiceStack
ServiceStack.Redis/tests/ServiceStack.Redis.Tests/ValueTypeExamples.Async.cs
{ "start": 3460, "end": 5268 }
public class ____ { public int Id { get; set; } public string Letter { get; set; } } [Test] public async Task Working_with_Generic_types() { await using var redisClient = new RedisClient(TestConfig.SingleHost).ForAsyncOnly(); //Create a typed Redis client that treats all values as IntAndString: var typedRedis = redisClient.As<IntAndString>(); var pocoValue = new IntAndString { Id = 1, Letter = "A" }; await typedRedis.SetValueAsync("pocoKey", pocoValue); IntAndString toPocoValue = await typedRedis.GetValueAsync("pocoKey"); Assert.That(toPocoValue.Id, Is.EqualTo(pocoValue.Id)); Assert.That(toPocoValue.Letter, Is.EqualTo(pocoValue.Letter)); var pocoListValues = new List<IntAndString> { new IntAndString {Id = 2, Letter = "B"}, new IntAndString {Id = 3, Letter = "C"}, new IntAndString {Id = 4, Letter = "D"}, new IntAndString {Id = 5, Letter = "E"}, }; IRedisListAsync<IntAndString> pocoList = typedRedis.Lists["pocoListKey"]; //Adding all IntAndString objects into the redis list 'pocoListKey' await pocoListValues.ForEachAsync(async x => await pocoList.AddAsync(x)); List<IntAndString> toPocoListValues = await pocoList.ToListAsync(); for (var i = 0; i < pocoListValues.Count; i++) { pocoValue = pocoListValues[i]; toPocoValue = toPocoListValues[i]; Assert.That(toPocoValue.Id, Is.EqualTo(pocoValue.Id)); Assert.That(toPocoValue.Letter, Is.EqualTo(pocoValue.Letter)); } } } }
IntAndString
csharp
nopSolutions__nopCommerce
src/Plugins/Nop.Plugin.Payments.PayPalCommerce/Services/Api/Models/Webhook.cs
{ "start": 148, "end": 1306 }
public class ____ { #region Properties /// <summary> /// Gets or sets the ID of the webhook. /// </summary> [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// <summary> /// Gets or sets the URL that is configured to listen on the server for incoming POST notification messages that contain event information. /// </summary> [JsonProperty(PropertyName = "url")] public string Url { get; set; } /// <summary> /// Gets or sets the array of events to which to subscribe your webhook. To subscribe to all events including events as they are added, specify the asterisk (`*`) wild card. To replace the `event_types` array, specify the `*` wild card. To list all supported events, [list available events](#available-event-type.list). /// </summary> [JsonProperty(PropertyName = "event_types")] public List<EventType> EventTypes { get; set; } /// <summary> /// Gets or sets the array of request-related [HATEOAS links](/docs/api/hateoas-links/). /// </summary> [JsonProperty(PropertyName = "links")] public List<Link> Links { get; set; } #endregion }
Webhook
csharp
abpframework__abp
modules/docs/src/Volo.Docs.Web/DocsWebGoogleOptions.cs
{ "start": 99, "end": 1302 }
public class ____ { public bool EnableGoogleTranslate { get; set; } /// <summary> /// https://cloud.google.com/translate/docs/languages /// </summary> public List<string> IncludedLanguages { get; set; } public Func<CultureInfo, string> GetCultureLanguageCode { get; set; } public bool EnableGoogleProgrammableSearchEngine { get; set; } public string GoogleSearchEngineId { get; set; } public DocsWebGoogleOptions() { EnableGoogleTranslate = false; IncludedLanguages = [ "en", "tr", "zh-CN", "zh-TW", "ar", "cs", "hu", "hr", "fi", "fr", "hi", "it", "pt", "ru", "sk", "de", "es" ]; GetCultureLanguageCode = culture => { return culture.Name switch { "zh-Hans" => "zh-CN", "zh-Hant" => "zh-TW", _ => culture.TwoLetterISOLanguageName }; }; EnableGoogleProgrammableSearchEngine = false; } }
DocsWebGoogleOptions
csharp
ShareX__ShareX
ShareX.UploadersLib/ImageUploaders/Imgur.cs
{ "start": 15115, "end": 15291 }
internal class ____ { public object error { get; set; } public string request { get; set; } public string method { get; set; } }
ImgurErrorData
csharp
dotnet__machinelearning
src/Microsoft.ML.Core/Environment/ConsoleEnvironment.cs
{ "start": 12689, "end": 17152 }
private sealed class ____ : ChannelBase { public readonly Stopwatch Watch; public Channel(ConsoleEnvironment root, ChannelProviderBase parent, string shortName, Action<IMessageSource, ChannelMessage> dispatch) : base(root, parent, shortName, dispatch) { Watch = Stopwatch.StartNew(); Root._consoleWriter.ChannelStarted(this); } protected override void Dispose(bool disposing) { if (disposing) { Watch.Stop(); Root._consoleWriter.ChannelDisposed(this); } base.Dispose(disposing); } } private volatile ConsoleWriter _consoleWriter; private readonly MessageSensitivity _sensitivityFlags; // This object is used to write to the test log along with the console if the host process is a test environment private readonly TextWriter _testWriter; /// <summary> /// Create an ML.NET <see cref="IHostEnvironment"/> for local execution, with console feedback. /// </summary> /// <param name="seed">Random seed. Set to <c>null</c> for a non-deterministic environment.</param> /// <param name="verbose">Set to <c>true</c> for fully verbose logging.</param> /// <param name="sensitivity">Allowed message sensitivity.</param> /// <param name="outWriter">Text writer to print normal messages to.</param> /// <param name="errWriter">Text writer to print error messages to.</param> /// <param name="testWriter">Optional TextWriter to write messages if the host is a test environment.</param> public ConsoleEnvironment(int? seed = null, bool verbose = false, MessageSensitivity sensitivity = MessageSensitivity.All, TextWriter outWriter = null, TextWriter errWriter = null, TextWriter testWriter = null) : base(seed, verbose, nameof(ConsoleEnvironment)) { Contracts.CheckValueOrNull(outWriter); Contracts.CheckValueOrNull(errWriter); _testWriter = testWriter; _consoleWriter = new ConsoleWriter(this, outWriter ?? Console.Out, errWriter ?? Console.Error, testWriter); _sensitivityFlags = sensitivity; AddListener<ChannelMessage>(PrintMessage); } /// <summary> /// Pull running calculations for their progress and output all messages to the console. /// If no messages are available, print a dot. /// If a specified number of dots are printed, print an ad-hoc status of all running calculations. /// </summary> public void PrintProgress() { Root._consoleWriter.GetAndPrintAllProgress(ProgressTracker); } private void PrintMessage(IMessageSource src, ChannelMessage msg) { Root._consoleWriter.PrintMessage(src, msg); } protected override IHost RegisterCore(HostEnvironmentBase<ConsoleEnvironment> source, string shortName, string parentFullName, Random rand, bool verbose) { Contracts.AssertValue(rand); Contracts.AssertValueOrNull(parentFullName); Contracts.AssertNonEmpty(shortName); Contracts.Assert(source == this || source is Host); return new Host(source, shortName, parentFullName, rand, verbose); } protected override IChannel CreateCommChannel(ChannelProviderBase parent, string name) { Contracts.AssertValue(parent); Contracts.Assert(parent is ConsoleEnvironment); Contracts.AssertNonEmpty(name); return new Channel(this, parent, name, GetDispatchDelegate<ChannelMessage>()); } protected override IPipe<TMessage> CreatePipe<TMessage>(ChannelProviderBase parent, string name) { Contracts.AssertValue(parent); Contracts.Assert(parent is ConsoleEnvironment); Contracts.AssertNonEmpty(name); return new Pipe<TMessage>(parent, name, GetDispatchDelegate<TMessage>()); } /// <summary> /// Redirects the channel output through the specified writers. /// </summary> /// <remarks>This method is not thread-safe.</remarks> internal IDisposable RedirectChannelOutput(TextWriter newOutWriter, TextWriter newErrWriter) { Contracts.CheckValue(newOutWriter, nameof(newOutWriter)); Contracts.CheckValue(newErrWriter, nameof(newErrWriter)); return new OutputRedirector(this, newOutWriter, newErrWriter); } internal void ResetProgressChannel() { ProgressTracker.Reset(); }
Channel
csharp
unoplatform__uno
src/Uno.UI/UI/Xaml/Application.cs
{ "start": 1512, "end": 3485 }
public partial class ____ { private bool _initializationComplete; private readonly static IEventProvider _trace = Tracing.Get(TraceProvider.Id); private ApplicationTheme _requestedTheme = ApplicationTheme.Dark; // Default theme in WinUI is Dark. private SpecializedResourceDictionary.ResourceKey _requestedThemeForResources; private bool _isInBackground; private ResourceDictionary _resources = new ResourceDictionary(); static Application() { ApiInformation.RegisterAssembly(typeof(Application).Assembly); ApiInformation.RegisterAssembly(typeof(ApplicationData).Assembly); ApiInformation.RegisterAssembly(typeof(Microsoft.UI.Composition.Compositor).Assembly); Uno.Helpers.DispatcherTimerProxy.SetDispatcherTimerGetter(() => new DispatcherTimer()); Uno.Helpers.VisualTreeHelperProxy.SetCloseAllFlyoutsAction(() => { var contentRoots = WinUICoreServices.Instance.ContentRootCoordinator.ContentRoots; foreach (var contentRoot in contentRoots) { Media.VisualTreeHelper.CloseAllFlyouts(contentRoot.XamlRoot); } }); RegisterExtensions(); InitializePartialStatic(); } /// <summary> /// Initializes a new instance of the Application class. /// </summary> public Application() { CoreApplication.StaticInitialize(); #if __SKIA__ || __WASM__ Package.SetEntryAssembly(this.GetType().Assembly); #endif Current = this; ApplicationLanguages.ApplyCulture(); InitializePartial(); } internal bool InitializationComplete => _initializationComplete; partial void InitializePartial(); private static void RegisterExtensions() { ApiExtensibility.Register<MessageDialog>(typeof(IMessageDialogExtension), dialog => new MessageDialogExtension(dialog)); #if __SKIA__ ApiExtensibility.Register(typeof(Uno.UI.Graphics.SKCanvasVisualBaseFactory), _ => new Uno.UI.Graphics.SKCanvasVisualFactory()); #endif } static partial void InitializePartialStatic(); [Preserve]
Application
csharp
dotnet__efcore
test/EFCore.Specification.Tests/TestModels/SnapshotMonsterContext.cs
{ "start": 10365, "end": 10737 }
public class ____ : IProductPhoto { public void InitializeCollections() => Features ??= new HashSet<IProductWebFeature>(); public int ProductId { get; set; } public int PhotoId { get; set; } public byte[] Photo { get; set; } public virtual ICollection<IProductWebFeature> Features { get; set; } }
ProductPhoto
csharp
unoplatform__uno
src/Uno.UI/UI/Xaml/Controls/TreeView/TreeViewNode.Properties.cs
{ "start": 291, "end": 2008 }
public partial class ____ { public object Content { get => (object)GetValue(ContentProperty); set => SetValue(ContentProperty, value); } public int Depth { get => (int)GetValue(DepthProperty); private set => SetValue(DepthProperty, value); } public bool HasChildren { get => (bool)GetValue(HasChildrenProperty); private set => SetValue(HasChildrenProperty, value); } public bool IsExpanded { get => (bool)GetValue(IsExpandedProperty); set => SetValue(IsExpandedProperty, value); } public static DependencyProperty ContentProperty { get; } = DependencyProperty.Register(nameof(Content), typeof(object), typeof(TreeViewNode), new FrameworkPropertyMetadata(null)); public static DependencyProperty DepthProperty { get; } = DependencyProperty.Register(nameof(Depth), typeof(int), typeof(TreeViewNode), new FrameworkPropertyMetadata(-1)); public static DependencyProperty HasChildrenProperty { get; } = DependencyProperty.Register(nameof(HasChildren), typeof(bool), typeof(TreeViewNode), new FrameworkPropertyMetadata(false, OnHasChildrenPropertyChanged)); public static DependencyProperty IsExpandedProperty { get; } = DependencyProperty.Register(nameof(IsExpanded), typeof(bool), typeof(TreeViewNode), new FrameworkPropertyMetadata(false, OnIsExpandedPropertyChanged)); private static void OnHasChildrenPropertyChanged( DependencyObject sender, DependencyPropertyChangedEventArgs args) { var owner = (TreeViewNode)sender; owner.OnPropertyChanged(args); } private static void OnIsExpandedPropertyChanged( DependencyObject sender, DependencyPropertyChangedEventArgs args) { var owner = (TreeViewNode)sender; owner.OnPropertyChanged(args); } }
TreeViewNode
csharp
smartstore__Smartstore
src/Smartstore/Data/Caching/CacheableEntityAttribute.cs
{ "start": 295, "end": 1102 }
public sealed class ____ : Attribute { /// <summary> /// Gets or sets a value indicating whether the entity should NEVER be cached, under no circumstances /// (event when caching was enabled on specific query level). /// Set this to <c>true</c> for 'toxic' entity types that are extremely volatile. /// </summary> public bool NeverCache { get; set; } /// <summary> /// Specifies a max rows limit. Query results with more items than the given number will not be cached. /// </summary> public int MaxRows { get; set; } /// <summary> /// Gets or sets the expiration timeout in minutes. Default value is 180 (3 hours). /// </summary> public int Expiry { get; set; } } }
CacheableEntityAttribute
csharp
EventStore__EventStore
src/KurrentDB.Projections.Core/Messages/ProjectionManagementMessage.cs
{ "start": 13470, "end": 14781 }
public sealed class ____ { private readonly ClaimsPrincipal _runAs; public RunAs(ClaimsPrincipal runAs) { _runAs = runAs; } private static readonly RunAs _anonymous = new RunAs(SystemAccounts.Anonymous); private static readonly RunAs _system = new RunAs(SystemAccounts.System); public static RunAs Anonymous { get { return _anonymous; } } public static RunAs System { get { return _system; } } public ClaimsPrincipal Principal { get { return _runAs; } } public static bool ValidateRunAs(ProjectionMode mode, ReadWrite readWrite, ClaimsPrincipal existingRunAs, Command.ControlMessage message, bool replace = false) { if (mode > ProjectionMode.Transient && readWrite == ReadWrite.Write && (message.RunAs == null || message.RunAs.Principal == null || !( message.RunAs.Principal.LegacyRoleCheck(SystemRoles.Admins) || message.RunAs.Principal.LegacyRoleCheck(SystemRoles.Operations) ))) { message.Envelope.ReplyWith(new NotAuthorized()); return false; } if (replace && message.RunAs.Principal == null) { message.Envelope.ReplyWith(new NotAuthorized()); return false; } return true; } } [DerivedMessage(ProjectionMessage.Management)]
RunAs
csharp
AvaloniaUI__Avalonia
src/Avalonia.X11/X11Structs.cs
{ "start": 8626, "end": 9045 }
internal struct ____ { internal XEventName type; internal IntPtr serial; internal int send_event; internal IntPtr display; internal IntPtr xevent; internal IntPtr window; internal int x; internal int y; internal int width; internal int height; internal int border_width; internal IntPtr above; internal int override_redirect; } [StructLayout(LayoutKind.Sequential)]
XConfigureEvent
csharp
dotnet__orleans
src/Orleans.Serialization/Codecs/NullableCodec.cs
{ "start": 2597, "end": 3455 }
public sealed class ____<T> : IDeepCopier<T?>, IOptionalDeepCopier where T : struct { private readonly IDeepCopier<T> _copier; /// <summary> /// Initializes a new instance of the <see cref="NullableCopier{T}"/> class. /// </summary> /// <param name="copier">The copier.</param> public NullableCopier(IDeepCopier<T> copier) => _copier = OrleansGeneratedCodeHelper.GetOptionalCopier(copier); public bool IsShallowCopyable() => _copier is null; object IDeepCopier.DeepCopy(object input, CopyContext context) => input is null || _copier is null ? input : _copier.DeepCopy(input, context); /// <inheritdoc/> public T? DeepCopy(T? input, CopyContext context) => input is null || _copier is null ? input : _copier.DeepCopy(input.GetValueOrDefault(), context); } }
NullableCopier
csharp
dotnet__maui
src/Essentials/src/Types/Contact.shared.cs
{ "start": 192, "end": 447 }
public class ____ { string displayName; /// <summary> /// Initializes a new instance of the <see cref="Contact"/> class. /// </summary> public Contact() { } /// <summary> /// Initializes a new instance of the <see cref="Contact"/>
Contact
csharp
microsoft__garnet
test/Garnet.test/AofFinalizeDoubleReplayTxn.cs
{ "start": 235, "end": 1010 }
public class ____ : CustomTransactionProcedure { public override bool Prepare<TGarnetReadApi>(TGarnetReadApi api, ref CustomProcedureInput procInput) { int offset = 0; AddKey(GetNextArg(ref procInput, ref offset), LockType.Exclusive, false); return true; } public override void Main<TGarnetApi>(TGarnetApi api, ref CustomProcedureInput procInput, ref MemoryResult<byte> output) { // No-op } public override void Finalize<TGarnetApi>(TGarnetApi api, ref CustomProcedureInput procInput, ref MemoryResult<byte> output) { int offset = 0; api.Increment(GetNextArg(ref procInput, ref offset), out _); } } }
AofFinalizeDoubleReplayTxn
csharp
microsoft__FASTER
cs/playground/CacheStoreConcurrent/Types.cs
{ "start": 1440, "end": 1612 }
public struct ____ { public int type; public long ticks; } /// <summary> /// Callback for FASTER operations /// </summary>
CacheContext
csharp
MonoGame__MonoGame
MonoGame.Framework.Content.Pipeline/Graphics/TextureProfile.cs
{ "start": 403, "end": 464 }
class ____ handling texture profiles. /// </summary>
for
csharp
bitwarden__server
src/Core/AdminConsole/Models/Data/EventIntegrations/IntegrationMessage.cs
{ "start": 923, "end": 1277 }
public class ____<T> : IntegrationMessage { public required T Configuration { get; set; } public override string ToJson() { return JsonSerializer.Serialize(this); } public static IntegrationMessage<T>? FromJson(string json) { return JsonSerializer.Deserialize<IntegrationMessage<T>>(json); } }
IntegrationMessage
csharp
ServiceStack__ServiceStack
ServiceStack.Blazor/tests/ServiceStack.Blazor.Bootstrap.Tests/Client/MarkdownUtils.cs
{ "start": 498, "end": 2452 }
public static class ____ { public static Dictionary<string, MarkdownFileInfo> Cache = new(); public static async Task<ApiResult<MarkdownFileInfo>> LoadDocumentAsync(string name, Func<MarkdownFileInfo, Task<string>> resolverAsync) { try { if (Cache.TryGetValue(name, out var cachedDoc)) return ApiResult.Create(cachedDoc); var pipeline = new MarkdownPipelineBuilder() .UseYamlFrontMatter() .UseAdvancedExtensions() .Build(); var writer = new System.IO.StringWriter(); var renderer = new Markdig.Renderers.HtmlRenderer(writer); pipeline.Setup(renderer); var doc = new MarkdownFileInfo { Path = name, FileName = $"{name}.md", }; doc.Content = await resolverAsync(doc); var document = Markdown.Parse(doc.Content!, pipeline); renderer.Render(document); var block = document .Descendants<Markdig.Extensions.Yaml.YamlFrontMatterBlock>() .FirstOrDefault(); var metaObj = block? .Lines // StringLineGroup[] .Lines // StringLine[] .Select(x => $"{x}\n") .ToList() .Select(x => x.Replace("---", string.Empty)) .Where(x => !string.IsNullOrWhiteSpace(x)) .Select(x => KeyValuePairs.Create(x.LeftPart(':').Trim(), x.RightPart(':').Trim())) .ToObjectDictionary(); metaObj?.PopulateInstance(doc); await writer.FlushAsync(); doc.Preview = writer.ToString(); Cache[name] = doc; return ApiResult.Create(doc); } catch (Exception ex) { return ApiResult.CreateError<MarkdownFileInfo>(ex.AsResponseStatus()); } } }
MarkdownUtils
csharp
ServiceStack__ServiceStack
ServiceStack.Text/tests/ServiceStack.Text.Tests/JsonObjectTests.cs
{ "start": 9650, "end": 10675 }
public class ____ { public static List<object> Setters = new List<object>(); private string name; private int age; private string address; public string Name { get { return name; } set { name = value; Setters.Add(value); } } public int Age { get { return age; } set { age = value; Setters.Add(value); } } public string Address { get { return address; } set { address = value; Setters.Add(value); } } } [Test] public void Only_sets_Setters_with_JSON() { var dto = "{\"Name\":\"Foo\"}".FromJson<Customer>(); Assert.That(dto.Name, Is.EqualTo("Foo")); Assert.That(Customer.Setters.Count, Is.EqualTo(1)); Assert.That(Customer.Setters[0], Is.EqualTo(dto.Name)); }
Customer
csharp
microsoft__PowerToys
src/modules/fancyzones/FancyZonesEditorCommon/Data/EditorParameters.cs
{ "start": 2360, "end": 2676 }
public struct ____ { public int ProcessId { get; set; } public bool SpanZonesAcrossMonitors { get; set; } public List<NativeMonitorDataWrapper> Monitors { get; set; } } public EditorParameters() : base() { } } }
ParamsWrapper
csharp
bitwarden__server
src/Admin/Enums/Permissions.cs
{ "start": 29, "end": 1426 }
public enum ____ { User_List_View, User_UserInformation_View, User_GeneralDetails_View, User_Delete, User_UpgradePremium, User_BillingInformation_View, User_BillingInformation_DownloadInvoice, User_BillingInformation_CreateEditTransaction, User_Premium_View, User_Premium_Edit, User_Licensing_View, User_Licensing_Edit, User_Billing_View, User_Billing_Edit, User_Billing_LaunchGateway, User_NewDeviceException_Edit, Org_List_View, Org_OrgInformation_View, Org_GeneralDetails_View, Org_Name_Edit, Org_CheckEnabledBox, Org_BusinessInformation_View, Org_InitiateTrial, Org_RequestDelete, Org_Delete, Org_BillingInformation_View, Org_BillingInformation_DownloadInvoice, Org_BillingInformation_CreateEditTransaction, Org_Plan_View, Org_Plan_Edit, Org_Licensing_View, Org_Licensing_Edit, Org_Billing_View, Org_Billing_Edit, Org_Billing_LaunchGateway, Org_Billing_ConvertToBusinessUnit, Provider_List_View, Provider_Create, Provider_Edit, Provider_View, Provider_ResendEmailInvite, Provider_CheckEnabledBox, Tools_ChargeBrainTreeCustomer, Tools_PromoteAdmin, Tools_PromoteProviderServiceUser, Tools_GenerateLicenseFile, Tools_ManageTaxRates, Tools_CreateEditTransaction, Tools_ProcessStripeEvents }
Permission
csharp
dotnet__orleans
src/api/Orleans.Serialization/Orleans.Serialization.cs
{ "start": 251629, "end": 253446 }
partial class ____<T> : global::Orleans.Serialization.Codecs.IFieldCodec<global::Orleans.Serialization.Codecs.ImmutableQueueSurrogate<T>>, global::Orleans.Serialization.Codecs.IFieldCodec, global::Orleans.Serialization.Serializers.IValueSerializer<global::Orleans.Serialization.Codecs.ImmutableQueueSurrogate<T>>, global::Orleans.Serialization.Serializers.IValueSerializer { public Codec_ImmutableQueueSurrogate(global::Orleans.Serialization.Serializers.ICodecProvider codecProvider) { } public void Deserialize<TReaderInput>(ref global::Orleans.Serialization.Buffers.Reader<TReaderInput> reader, scoped ref global::Orleans.Serialization.Codecs.ImmutableQueueSurrogate<T> instance) { } public global::Orleans.Serialization.Codecs.ImmutableQueueSurrogate<T> ReadValue<TReaderInput>(ref global::Orleans.Serialization.Buffers.Reader<TReaderInput> reader, global::Orleans.Serialization.WireProtocol.Field field) { throw null; } public void Serialize<TBufferWriter>(ref global::Orleans.Serialization.Buffers.Writer<TBufferWriter> writer, scoped ref global::Orleans.Serialization.Codecs.ImmutableQueueSurrogate<T> instance) where TBufferWriter : System.Buffers.IBufferWriter<byte> { } public void WriteField<TBufferWriter>(ref global::Orleans.Serialization.Buffers.Writer<TBufferWriter> writer, uint fieldIdDelta, System.Type expectedType, global::Orleans.Serialization.Codecs.ImmutableQueueSurrogate<T> value) where TBufferWriter : System.Buffers.IBufferWriter<byte> { } } [System.CodeDom.Compiler.GeneratedCode("OrleansCodeGen", "9.0.0.0")] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] public sealed
Codec_ImmutableQueueSurrogate
csharp
NLog__NLog
src/NLog/LayoutRenderers/Wrappers/LowercaseLayoutRendererWrapper.cs
{ "start": 2307, "end": 4317 }
public sealed class ____ : WrapperLayoutRendererBase { /// <summary> /// Gets or sets a value indicating whether lower case conversion should be applied. /// </summary> /// <value>A value of <see langword="true"/> if lower case conversion should be applied; otherwise, <see langword="false"/>.</value> /// <docgen category='Layout Options' order='10' /> public bool Lowercase { get; set; } = true; /// <summary> /// Same as <see cref="Lowercase"/>-property, so it can be used as ambient property. /// </summary> /// <example> /// ${level:tolower} /// </example> /// <docgen category="Layout Options" order="10"/> public bool ToLower { get => Lowercase; set => Lowercase = value; } /// <summary> /// Gets or sets the culture used for rendering. /// </summary> /// <remarks>Default: <see cref="CultureInfo.InvariantCulture"/></remarks> /// <docgen category='Layout Options' order='100' /> public CultureInfo Culture { get; set; } = CultureInfo.InvariantCulture; /// <inheritdoc/> protected override void RenderInnerAndTransform(LogEventInfo logEvent, StringBuilder builder, int orgLength) { Inner?.Render(logEvent, builder); if (Lowercase && builder.Length > orgLength) { TransformToLowerCase(builder, logEvent, orgLength); } } /// <inheritdoc/> protected override string Transform(string text) { throw new NotSupportedException(); } private void TransformToLowerCase(StringBuilder target, LogEventInfo logEvent, int startPos) { CultureInfo culture = GetCulture(logEvent, Culture); for (int i = startPos; i < target.Length; ++i) { target[i] = char.ToLower(target[i], culture); } } } }
LowercaseLayoutRendererWrapper
csharp
unoplatform__uno
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2FrameInfo.cs
{ "start": 302, "end": 3792 }
public partial class ____ { #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ internal CoreWebView2FrameInfo() { } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public string Name { get { throw new global::System.NotImplementedException("The member string CoreWebView2FrameInfo.Name is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=string%20CoreWebView2FrameInfo.Name"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public string Source { get { throw new global::System.NotImplementedException("The member string CoreWebView2FrameInfo.Source is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=string%20CoreWebView2FrameInfo.Source"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public uint FrameId { get { throw new global::System.NotImplementedException("The member uint CoreWebView2FrameInfo.FrameId is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=uint%20CoreWebView2FrameInfo.FrameId"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public global::Microsoft.Web.WebView2.Core.CoreWebView2FrameKind FrameKind { get { throw new global::System.NotImplementedException("The member CoreWebView2FrameKind CoreWebView2FrameInfo.FrameKind is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=CoreWebView2FrameKind%20CoreWebView2FrameInfo.FrameKind"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public global::Microsoft.Web.WebView2.Core.CoreWebView2FrameInfo ParentFrameInfo { get { throw new global::System.NotImplementedException("The member CoreWebView2FrameInfo CoreWebView2FrameInfo.ParentFrameInfo is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=CoreWebView2FrameInfo%20CoreWebView2FrameInfo.ParentFrameInfo"); } } #endif // Forced skipping of method Microsoft.Web.WebView2.Core.CoreWebView2FrameInfo.ParentFrameInfo.get // Forced skipping of method Microsoft.Web.WebView2.Core.CoreWebView2FrameInfo.FrameId.get // Forced skipping of method Microsoft.Web.WebView2.Core.CoreWebView2FrameInfo.FrameKind.get // Forced skipping of method Microsoft.Web.WebView2.Core.CoreWebView2FrameInfo.Name.get // Forced skipping of method Microsoft.Web.WebView2.Core.CoreWebView2FrameInfo.Source.get } }
CoreWebView2FrameInfo
csharp
MonoGame__MonoGame
Tools/MonoGame.Content.Builder.Editor/Controls/PropertyGridControl.cs
{ "start": 363, "end": 5286 }
public partial class ____ { private RadioCommand _cmdSortAbc, _cmdSortGroup; private List<object> _objects; public PropertyGridControl() { InitializeComponent(); _cmdSortAbc = new RadioCommand(); _cmdSortAbc.MenuText = "Sort Alphabetically"; _cmdSortAbc.CheckedChanged += CmdSort_CheckedChanged; AddCommand(_cmdSortAbc); _cmdSortGroup = new RadioCommand(); _cmdSortGroup.Controller = _cmdSortAbc; _cmdSortGroup.MenuText = "Sort by Category"; _cmdSortGroup.CheckedChanged += CmdSort_CheckedChanged; AddCommand(_cmdSortGroup); _objects = new List<object>(); } public override void LoadSettings() { if (PipelineSettings.Default.PropertyGroupSort) _cmdSortGroup.Checked = true; else _cmdSortAbc.Checked = true; } private void CmdSort_CheckedChanged(object sender, EventArgs e) { PipelineSettings.Default.PropertyGroupSort = _cmdSortGroup.Checked; propertyTable.Group = _cmdSortGroup.Checked; propertyTable.Update(); } private void BtnGroup_Click(object sender, EventArgs e) { propertyTable.Group = true; propertyTable.Update(); } public void SetObjects(List<IProjectItem> objects) { _objects = objects.Cast<object>().ToList(); Reload(); } public void Reload() { propertyTable.Clear(); if (_objects.Count != 0) LoadProps(_objects); propertyTable.Update(); } private bool CompareVariables(ref object a, object b, PropertyInfo p) { var prop = b.GetType().GetProperty(p.Name); if (prop == null) return false; if (a == null || !a.Equals(prop.GetValue(b, null))) a = null; return true; } private void LoadProps(List<object> objects) { var props = objects[0].GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (var p in props) { var attrs = p.GetCustomAttributes(true); var name = p.Name; var browsable = true; var category = "Mics"; foreach (var a in attrs) { if (a is BrowsableAttribute) browsable = (a as BrowsableAttribute).Browsable; else if (a is CategoryAttribute) category = (a as CategoryAttribute).Category; else if (a is DisplayNameAttribute) name = (a as DisplayNameAttribute).DisplayName; } object value = p.GetValue(objects[0], null); foreach (object o in objects) { if (!CompareVariables(ref value, o, p)) { browsable = false; break; } } if (!browsable) continue; propertyTable.AddEntry(category, name, value, p.PropertyType, (sender, e) => { var action = new UpdatePropertyAction(MainWindow.Instance, objects, p, sender); PipelineController.Instance.AddAction(action); action.Do(); }, p.CanWrite); if (value is ProcessorTypeDescription) LoadProcessorParams(_objects.Cast<ContentItem>().ToList()); } } private void LoadProcessorParams(List<ContentItem> objects) { foreach (var p in objects[0].Processor.Properties) { if (!p.Browsable) continue; object value = objects[0].ProcessorParams[p.Name]; foreach (ContentItem o in objects) { if (value == null || !value.Equals(o.ProcessorParams[p.Name])) { value = null; break; } } propertyTable.AddEntry("Processor Parameters", p.DisplayName, value, p.Type, (sender, e) => { var action = new UpdateProcessorAction(MainWindow.Instance, objects.Cast<ContentItem>().ToList(), p.Name, sender); PipelineController.Instance.AddAction(action); action.Do(); }, true); } } public void SetWidth() { propertyTable.SetWidth(); } } }
PropertyGridControl
csharp
CommunityToolkit__Maui
src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.macios.cs
{ "start": 260, "end": 19119 }
public partial class ____ : IDisposable { Metadata? metaData; // Media would still start playing when Speed was set although ShouldAutoPlay=False // This field was added to overcome that. bool isInitialSpeedSet; /// <summary> /// Creates the corresponding platform view of <see cref="MediaElement"/> on iOS and macOS. /// </summary> /// <returns>The platform native counterpart of <see cref="MediaElement"/>.</returns> public (PlatformMediaElement Player, AVPlayerViewController PlayerViewController) CreatePlatformView() { Player = new(); PlayerViewController = new() { Player = Player }; // Pre-initialize Volume and Muted properties to the player object Player.Muted = MediaElement.ShouldMute; var volumeDiff = Math.Abs(Player.Volume - MediaElement.Volume); if (volumeDiff > 0.01) { Player.Volume = (float)MediaElement.Volume; } UIApplication.SharedApplication.BeginReceivingRemoteControlEvents(); #if IOS PlayerViewController.UpdatesNowPlayingInfoCenter = false; #else PlayerViewController.UpdatesNowPlayingInfoCenter = true; #endif var avSession = AVAudioSession.SharedInstance(); avSession.SetCategory(AVAudioSessionCategory.Playback); avSession.SetActive(true); AddStatusObservers(); AddPlayedToEndObserver(); AddErrorObservers(); return (Player, PlayerViewController); } /// <summary> /// Releases the managed and unmanaged resources used by the <see cref="MediaManager"/>. /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } /// <summary> /// The default <see cref="NSKeyValueObservingOptions"/> flags used in the iOS and macOS observers. /// </summary> protected NSKeyValueObservingOptions ValueObserverOptions => NSKeyValueObservingOptions.Initial | NSKeyValueObservingOptions.New; /// <summary> /// Observer that tracks when an error has occurred in the playback of the current item. /// </summary> protected IDisposable? CurrentItemErrorObserver { get; set; } /// <summary> /// Observer that tracks when an error has occurred with media playback. /// </summary> protected NSObject? ErrorObserver { get; set; } /// <summary> /// Observer that tracks when the media has failed to play to the end. /// </summary> protected NSObject? ItemFailedToPlayToEndTimeObserver { get; set; } /// <summary> /// Observer that tracks when the playback of media has stalled. /// </summary> protected NSObject? PlaybackStalledObserver { get; set; } /// <summary> /// Observer that tracks when the media has played to the end. /// </summary> protected NSObject? PlayedToEndObserver { get; set; } /// <summary> /// The current media playback item. /// </summary> protected AVPlayerItem? PlayerItem { get; set; } /// <summary> /// The <see cref="AVPlayerViewController"/> that hosts the media Player. /// </summary> protected AVPlayerViewController? PlayerViewController { get; set; } /// <summary> /// Observer that tracks the playback rate of the media. /// </summary> protected IDisposable? RateObserver { get; set; } /// <summary> /// Observer that tracks the status of the media. /// </summary> protected IDisposable? StatusObserver { get; set; } /// <summary> /// Observer that tracks the time control status of the media. /// </summary> protected IDisposable? TimeControlStatusObserver { get; set; } /// <summary> /// Observer that tracks the volume of the media playback. /// </summary> protected IDisposable? VolumeObserver { get; set; } /// <summary> /// Observer that tracks if the audio is muted. /// </summary> protected IDisposable? MutedObserver { get; set; } protected virtual partial void PlatformPlay() { if (Player?.CurrentTime == PlayerItem?.Duration) { return; } Player?.Play(); } protected virtual partial void PlatformPause() { Player?.Pause(); } protected virtual async partial Task PlatformSeek(TimeSpan position, CancellationToken token) { token.ThrowIfCancellationRequested(); var seekTaskCompletionSource = new TaskCompletionSource(); if (Player?.CurrentItem is null) { throw new InvalidOperationException($"{nameof(AVPlayer)}.{nameof(AVPlayer.CurrentItem)} is not yet initialized"); } if (Player.Status is not AVPlayerStatus.ReadyToPlay) { throw new InvalidOperationException($"{nameof(AVPlayer)}.{nameof(AVPlayer.Status)} must first be set to {AVPlayerStatus.ReadyToPlay}"); } var ranges = Player.CurrentItem.SeekableTimeRanges; var seekToTime = new CMTime(Convert.ToInt64(position.TotalMilliseconds), 1000); foreach (var range in ranges.Select(r => r.CMTimeRangeValue)) { if (seekToTime >= range.Start && seekToTime < (range.Start + range.Duration)) { Player.Seek(seekToTime, complete => { if (!complete) { throw new InvalidOperationException("Seek Failed"); } seekTaskCompletionSource.SetResult(); }); break; } } await seekTaskCompletionSource.Task.WaitAsync(token); MediaElement.SeekCompleted(); } protected virtual partial void PlatformStop() { // There's no Stop method so pause the video and reset its position Player?.Seek(CMTime.Zero); Player?.Pause(); MediaElement.CurrentStateChanged(MediaElementState.Stopped); } protected virtual partial void PlatformUpdateAspect() { if (PlayerViewController is null) { return; } PlayerViewController.VideoGravity = MediaElement.Aspect switch { Aspect.Fill => AVLayerVideoGravity.Resize, Aspect.AspectFill => AVLayerVideoGravity.ResizeAspectFill, _ => AVLayerVideoGravity.ResizeAspect, }; } protected virtual async partial ValueTask PlatformUpdateSource() { MediaElement.CurrentStateChanged(MediaElementState.Opening); AVAsset? asset = null; if (Player is null) { return; } metaData ??= new(Player); Metadata.ClearNowPlaying(); PlayerViewController?.ContentOverlayView?.Subviews.FirstOrDefault()?.RemoveFromSuperview(); if (MediaElement.Source is UriMediaSource uriMediaSource) { var uri = uriMediaSource.Uri; if (!string.IsNullOrWhiteSpace(uri?.AbsoluteUri)) { asset = AVAsset.FromUrl(new NSUrl(uri.AbsoluteUri)); } } else if (MediaElement.Source is FileMediaSource fileMediaSource) { var uri = fileMediaSource.Path; if (!string.IsNullOrWhiteSpace(uri)) { asset = AVAsset.FromUrl(NSUrl.CreateFileUrl(uri)); } } else if (MediaElement.Source is ResourceMediaSource resourceMediaSource) { var path = resourceMediaSource.Path; if (!string.IsNullOrWhiteSpace(path) && Path.HasExtension(path)) { string directory = Path.GetDirectoryName(path) ?? ""; string filename = Path.GetFileNameWithoutExtension(path); string extension = Path.GetExtension(path)[1..]; var url = NSBundle.MainBundle.GetUrlForResource(filename, extension, directory); asset = AVAsset.FromUrl(url); } else { Logger.LogWarning("Invalid file path for ResourceMediaSource."); } } PlayerItem = asset is not null ? new AVPlayerItem(asset) : null; metaData.SetMetadata(PlayerItem, MediaElement); CurrentItemErrorObserver?.Dispose(); Player.ReplaceCurrentItemWithPlayerItem(PlayerItem); CurrentItemErrorObserver = PlayerItem?.AddObserver("error", ValueObserverOptions, (NSObservedChange change) => { if (Player.CurrentItem?.Error is null) { return; } var message = $"{Player.CurrentItem?.Error?.LocalizedDescription} - " + $"{Player.CurrentItem?.Error?.LocalizedFailureReason}"; MediaElement.MediaFailed( new MediaFailedEventArgs(message)); Logger.LogError("{LogMessage}", message); }); if (PlayerItem is not null && PlayerItem.Error is null) { MediaElement.MediaOpened(); (MediaElement.MediaWidth, MediaElement.MediaHeight) = await GetVideoDimensions(PlayerItem); if (MediaElement.ShouldAutoPlay) { Player.Play(); } await SetPoster(); } else if (PlayerItem is null) { MediaElement.MediaWidth = MediaElement.MediaHeight = 0; MediaElement.CurrentStateChanged(MediaElementState.None); } } protected virtual partial void PlatformUpdateSpeed() { if (PlayerViewController?.Player is null) { return; } // First time we're getting a playback speed and should NOT auto play, do nothing. if (!isInitialSpeedSet && !MediaElement.ShouldAutoPlay) { isInitialSpeedSet = true; return; } PlayerViewController.Player.Rate = (float)MediaElement.Speed; } protected virtual partial void PlatformUpdateShouldShowPlaybackControls() { if (PlayerViewController is null) { return; } PlayerViewController.ShowsPlaybackControls = MediaElement.ShouldShowPlaybackControls; } protected virtual partial void PlatformUpdatePosition() { if (Player is null) { return; } if (PlayerItem is not null) { if (PlayerItem.Duration == CMTime.Indefinite) { var range = PlayerItem.SeekableTimeRanges?.LastOrDefault(); if (range?.CMTimeRangeValue is not null) { MediaElement.Duration = ConvertTime(range.CMTimeRangeValue.Duration); MediaElement.Position = ConvertTime(PlayerItem.CurrentTime); } } else { MediaElement.Duration = ConvertTime(PlayerItem.Duration); MediaElement.Position = ConvertTime(PlayerItem.CurrentTime); } } else { Player.Pause(); MediaElement.Duration = MediaElement.Position = TimeSpan.Zero; } } protected virtual partial void PlatformUpdateVolume() { if (Player is null) { return; } var volumeDiff = Math.Abs(Player.Volume - MediaElement.Volume); if (volumeDiff > 0.01) { Player.Volume = (float)MediaElement.Volume; } } protected virtual partial void PlatformUpdateShouldKeepScreenOn() { if (Player is null) { return; } UIApplication.SharedApplication.IdleTimerDisabled = MediaElement.ShouldKeepScreenOn; } protected virtual partial void PlatformUpdateShouldMute() { if (Player is null) { return; } Player.Muted = MediaElement.ShouldMute; } protected virtual partial void PlatformUpdateShouldLoopPlayback() { // no-op we loop through using the PlayedToEndObserver } /// <summary> /// Releases the unmanaged resources used by the <see cref="MediaManager"/> and optionally releases the managed resources. /// </summary> /// <param name="disposing"><see langword="true"/> to release both managed and unmanaged resources; <see langword="false"/> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if (Player is not null) { Player.Pause(); Player.InvokeOnMainThread(() => { UIApplication.SharedApplication.EndReceivingRemoteControlEvents(); }); // disable the idle timer so screen turns off when media is not playing UIApplication.SharedApplication.IdleTimerDisabled = false; var audioSession = AVAudioSession.SharedInstance(); audioSession.SetActive(false); DestroyErrorObservers(); DestroyPlayedToEndObserver(); RateObserver?.Dispose(); RateObserver = null; CurrentItemErrorObserver?.Dispose(); CurrentItemErrorObserver = null; Player.ReplaceCurrentItemWithPlayerItem(null); MutedObserver?.Dispose(); MutedObserver = null; VolumeObserver?.Dispose(); VolumeObserver = null; StatusObserver?.Dispose(); StatusObserver = null; TimeControlStatusObserver?.Dispose(); TimeControlStatusObserver = null; Player.Dispose(); Player = null; } PlayerViewController?.Dispose(); PlayerViewController = null; } } static TimeSpan ConvertTime(CMTime cmTime) => TimeSpan.FromSeconds(double.IsNaN(cmTime.Seconds) ? 0 : cmTime.Seconds); static async Task<(int Width, int Height)> GetVideoDimensions(AVPlayerItem avPlayerItem) { // Create an AVAsset instance with the video file URL var asset = avPlayerItem.Asset; // Retrieve the video track var videoTrack = await GetTrack(asset); if (videoTrack is null) { // HLS doesn't have tracks, try to get the dimensions this way return !avPlayerItem.PresentationSize.IsEmpty ? ((int)avPlayerItem.PresentationSize.Width, (int)avPlayerItem.PresentationSize.Height) // If all else fails, just return 0, 0 : (0, 0); } // Get the natural size of the video var size = videoTrack.NaturalSize; var preferredTransform = videoTrack.PreferredTransform; // Apply the preferred transform to get the correct dimensions var transformedSize = CGAffineTransform.CGRectApplyAffineTransform(new CGRect(CGPoint.Empty, size), preferredTransform); var width = Math.Abs(transformedSize.Width); var height = Math.Abs(transformedSize.Height); return ((int)width, (int)height); } static async Task<AVAssetTrack?> GetTrack(AVAsset asset) { if (!(OperatingSystem.IsMacCatalystVersionAtLeast(18) || OperatingSystem.IsIOSVersionAtLeast(18))) { // AVAsset.TracksWithMediaType is Obsolete on iOS 18+ and MacCatalyst 18+ return asset.TracksWithMediaType(AVMediaTypes.Video.GetConstant() ?? "0").FirstOrDefault(); } var tracks = await asset.LoadTracksWithMediaTypeAsync(AVMediaTypes.Video.GetConstant() ?? "0"); return tracks.Count <= 0 ? null : tracks[0]; } void AddStatusObservers() { if (Player is null) { return; } MutedObserver = Player.AddObserver("muted", ValueObserverOptions, MutedChanged); VolumeObserver = Player.AddObserver("volume", ValueObserverOptions, VolumeChanged); StatusObserver = Player.AddObserver("status", ValueObserverOptions, StatusChanged); TimeControlStatusObserver = Player.AddObserver("timeControlStatus", ValueObserverOptions, TimeControlStatusChanged); RateObserver = AVPlayer.Notifications.ObserveRateDidChange(RateChanged); } async Task SetPoster() { if (PlayerItem is null || metaData is null) { return; } var videoTrack = await GetTrack(PlayerItem.Asset); if (videoTrack is not null) { return; } if (PlayerItem.Asset.Tracks.Length == 0) { // No video track found and no tracks found. This is likely an audio file. So we can't set a poster. return; } if (PlayerViewController?.View is not null && PlayerViewController.ContentOverlayView is not null && !string.IsNullOrEmpty(MediaElement.MetadataArtworkUrl)) { var image = UIImage.LoadFromData(NSData.FromUrl(new NSUrl(MediaElement.MetadataArtworkUrl))) ?? new UIImage(); var imageView = new UIImageView(image) { ContentMode = UIViewContentMode.ScaleAspectFit, TranslatesAutoresizingMaskIntoConstraints = false, ClipsToBounds = true, AutoresizingMask = UIViewAutoresizing.FlexibleDimensions }; PlayerViewController.ContentOverlayView.AddSubview(imageView); NSLayoutConstraint.ActivateConstraints( [ imageView.CenterXAnchor.ConstraintEqualTo(PlayerViewController.ContentOverlayView.CenterXAnchor), imageView.CenterYAnchor.ConstraintEqualTo(PlayerViewController.ContentOverlayView.CenterYAnchor), imageView.WidthAnchor.ConstraintLessThanOrEqualTo(PlayerViewController.ContentOverlayView.WidthAnchor), imageView.HeightAnchor.ConstraintLessThanOrEqualTo(PlayerViewController.ContentOverlayView.HeightAnchor), // Maintain the aspect ratio imageView.WidthAnchor.ConstraintEqualTo(imageView.HeightAnchor, image.Size.Width / image.Size.Height) ]); } } void VolumeChanged(NSObservedChange e) { if (Player is null) { return; } var volumeDiff = Math.Abs(Player.Volume - MediaElement.Volume); if (volumeDiff > 0.01) { MediaElement.Volume = Player.Volume; } } void MutedChanged(NSObservedChange e) { if (Player is null) { return; } MediaElement.ShouldMute = Player.Muted; } void AddErrorObservers() { DestroyErrorObservers(); ItemFailedToPlayToEndTimeObserver = AVPlayerItem.Notifications.ObserveItemFailedToPlayToEndTime(ErrorOccurred); PlaybackStalledObserver = AVPlayerItem.Notifications.ObservePlaybackStalled(ErrorOccurred); ErrorObserver = AVPlayerItem.Notifications.ObserveNewErrorLogEntry(ErrorOccurred); } void AddPlayedToEndObserver() { DestroyPlayedToEndObserver(); PlayedToEndObserver = AVPlayerItem.Notifications.ObserveDidPlayToEndTime(PlayedToEnd); } void DestroyErrorObservers() { ItemFailedToPlayToEndTimeObserver?.Dispose(); PlaybackStalledObserver?.Dispose(); ErrorObserver?.Dispose(); } void DestroyPlayedToEndObserver() { PlayedToEndObserver?.Dispose(); } void StatusChanged(NSObservedChange obj) { if (Player is null) { return; } var newState = Player.Status switch { AVPlayerStatus.Unknown => MediaElementState.Stopped, AVPlayerStatus.ReadyToPlay => MediaElementState.Paused, AVPlayerStatus.Failed => MediaElementState.Failed, _ => MediaElement.CurrentState }; MediaElement.CurrentStateChanged(newState); } void TimeControlStatusChanged(NSObservedChange obj) { if (Player is null || Player.Status is AVPlayerStatus.Unknown || Player.CurrentItem?.Error is not null) { return; } var newState = Player.TimeControlStatus switch { AVPlayerTimeControlStatus.Paused => MediaElementState.Paused, AVPlayerTimeControlStatus.Playing => MediaElementState.Playing, AVPlayerTimeControlStatus.WaitingToPlayAtSpecifiedRate => MediaElementState.Buffering, _ => MediaElement.CurrentState }; metaData?.SetMetadata(PlayerItem, MediaElement); MediaElement.CurrentStateChanged(newState); } void ErrorOccurred(object? sender, NSNotificationEventArgs args) { string message; var error = Player?.CurrentItem?.Error; if (error is not null) { message = error.LocalizedDescription; MediaElement.MediaFailed(new MediaFailedEventArgs(message)); Logger.LogError("{LogMessage}", message); } else { // Non-fatal error, just log message = args.Notification?.ToString() ?? "Media playback failed for an unknown reason."; Logger?.LogWarning("{LogMessage}", message); } } void PlayedToEnd(object? sender, NSNotificationEventArgs args) { if (args.Notification.Object != PlayerViewController?.Player?.CurrentItem || Player is null) { return; } if (MediaElement.ShouldLoopPlayback) { PlayerViewController?.Player?.Seek(CMTime.Zero); Player.Play(); } else { try { DispatchQueue.MainQueue.DispatchAsync(MediaElement.MediaEnded); } catch (Exception e) { Logger.LogWarning(e, "{LogMessage}", $"Failed to play media to end."); } } } void RateChanged(object? sender, NSNotificationEventArgs args) { if (Player is null) { return; } if (!AreFloatingPointNumbersEqual(MediaElement.Speed, Player.Rate)) { MediaElement.Speed = Player.Rate; if (metaData is not null) { metaData.NowPlayingInfo.PlaybackRate = (float)MediaElement.Speed; MPNowPlayingInfoCenter.DefaultCenter.NowPlaying = metaData.NowPlayingInfo; } } } }
MediaManager
csharp
MassTransit__MassTransit
src/MassTransit/Internals/Caching/ValueTracker.cs
{ "start": 100, "end": 215 }
public class ____<TValue, TCacheValue> : IValueTracker<TValue, TCacheValue> where TValue :
ValueTracker
csharp
dotnet__efcore
src/EFCore/Query/MaterializeCollectionNavigationExpression.cs
{ "start": 938, "end": 3379 }
public class ____ : Expression, IPrintableExpression { /// <summary> /// Creates a new instance of the <see cref="MaterializeCollectionNavigationExpression" /> class. /// </summary> /// <param name="subquery">An expression representing how to get value from query to create the collection.</param> /// <param name="navigation">A navigation associated with this collection.</param> public MaterializeCollectionNavigationExpression(Expression subquery, INavigationBase navigation) { Subquery = subquery; Navigation = navigation; } /// <summary> /// The expression that returns the values from query used to create the collection. /// </summary> public virtual Expression Subquery { get; } /// <summary> /// The navigation associated with this collection. /// </summary> public virtual INavigationBase Navigation { get; } /// <inheritdoc /> public sealed override ExpressionType NodeType => ExpressionType.Extension; /// <inheritdoc /> public override Type Type => Navigation.ClrType; /// <inheritdoc /> protected override Expression VisitChildren(ExpressionVisitor visitor) => Update(visitor.Visit(Subquery)); /// <summary> /// Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will /// return this expression. /// </summary> /// <param name="subquery">The <see cref="Subquery" /> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public virtual MaterializeCollectionNavigationExpression Update(Expression subquery) => subquery != Subquery ? new MaterializeCollectionNavigationExpression(subquery, Navigation) : this; /// <inheritdoc /> void IPrintableExpression.Print(ExpressionPrinter expressionPrinter) { expressionPrinter.AppendLine("MaterializeCollectionNavigation("); using (expressionPrinter.Indent()) { expressionPrinter.AppendLine($"Navigation: {Navigation.DeclaringEntityType.DisplayName()}.{Navigation.Name},"); expressionPrinter.Append("Subquery: "); expressionPrinter.Visit(Subquery); expressionPrinter.Append(")"); } } }
MaterializeCollectionNavigationExpression
csharp
AutoMapper__AutoMapper
src/UnitTests/Mappers/TypeHelperTests.cs
{ "start": 453, "end": 637 }
public class ____ : Collection<Charge>, IChargeCollection { public new IEnumerator<object> GetEnumerator() { return null; } } }
ChargeCollection
csharp
xunit__xunit
src/common/MessagePartials/BaseMessages/MessageSinkMessage.cs
{ "start": 1697, "end": 2339 }
class ____ not have a <see cref="JsonTypeIDAttribute"/>.</exception> /// <exception cref="UnsetPropertiesException">Thrown when one or more properties are missing values.</exception> public string ToJson() { if (type is null) throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Message sink message type '{0}' is missing its [JsonTypeID] decoration", GetType().SafeName())); ValidateObjectState(); var buffer = new StringBuilder(); using (var serializer = new JsonObjectSerializer(buffer)) { serializer.Serialize("$type", type); Serialize(serializer); } return buffer.ToString(); } }
does
csharp
dotnet__aspire
src/Aspire.Dashboard/Utils/MaxItemCountHelper.cs
{ "start": 804, "end": 2594 }
public static class ____<TItem> { private static readonly Func<Virtualize<TItem>, int>? s_getMaxItemCount = CreateGetter(); private static readonly Action<Virtualize<TItem>, int>? s_setMaxItemCount = CreateSetter(); private static Func<Virtualize<TItem>, int>? CreateGetter() { var type = typeof(Virtualize<TItem>); var prop = type.GetProperty("MaxItemCount", BindingFlags.Instance | BindingFlags.Public); if (prop == null || !prop.CanRead) { return null; } var instance = Expression.Parameter(type, "virtualize"); var body = Expression.Property(instance, prop); return Expression.Lambda<Func<Virtualize<TItem>, int>>(body, instance).Compile(); } private static Action<Virtualize<TItem>, int>? CreateSetter() { var type = typeof(Virtualize<TItem>); var prop = type.GetProperty("MaxItemCount", BindingFlags.Instance | BindingFlags.Public); if (prop == null || !prop.CanWrite) { return null; } var instance = Expression.Parameter(type, "virtualize"); var valueParam = Expression.Parameter(typeof(int), "value"); var body = Expression.Assign(Expression.Property(instance, prop), valueParam); return Expression.Lambda<Action<Virtualize<TItem>, int>>(body, instance, valueParam).Compile(); } public static bool TrySetMaxItemCount(Virtualize<TItem> virtualize, int max) { if (s_getMaxItemCount == null || s_setMaxItemCount == null) { return false; } if (s_getMaxItemCount(virtualize) == max) { return false; } s_setMaxItemCount(virtualize, max); return true; } }
VirtualizeHelper
csharp
neuecc__MessagePack-CSharp
src/MessagePack/Formatters/CollectionFormatter.cs
{ "start": 20029, "end": 20836 }
public sealed class ____<T> : CollectionFormatterBase<T, LinkedList<T>, LinkedList<T>.Enumerator, LinkedList<T>> { protected override void Add(LinkedList<T> collection, int index, T value, MessagePackSerializerOptions options) { collection.AddLast(value); } protected override LinkedList<T> Complete(LinkedList<T> intermediateCollection) { return intermediateCollection; } protected override LinkedList<T> Create(int count, MessagePackSerializerOptions options) { return new LinkedList<T>(); } protected override LinkedList<T>.Enumerator GetSourceEnumerator(LinkedList<T> source) { return source.GetEnumerator(); } } [Preserve]
LinkedListFormatter
csharp
dotnet__maui
src/Controls/tests/Xaml.UnitTests/Issues/Gh1497.xaml.cs
{ "start": 409, "end": 644 }
class ____ { [Test] public void GenericsIssue([Values] XamlInflator inflator) { var layout = new Gh1497(inflator); Assert.That(layout.entry.Behaviors[0], Is.TypeOf(typeof(Gh1497EntryValidationBehavior<Entry>))); } } }
Tests
csharp
MassTransit__MassTransit
src/MassTransit.TestFramework/ForkJoint/Contracts/SubmitOrder.cs
{ "start": 83, "end": 290 }
public interface ____ { Guid OrderId { get; } Burger[] Burgers { get; } Fry[] Fries { get; } Shake[] Shakes { get; } FryShake[] FryShakes { get; } } }
SubmitOrder
csharp
unoplatform__uno
src/Uno.UI/UI/Xaml/Controls/TwoPaneView/TwoPaneViewMode.cs
{ "start": 355, "end": 618 }
public enum ____ { /// <summary> /// Only one pane is shown. /// </summary> SinglePane = 0, /// <summary> /// Panes are shown side-by-side. /// </summary> Wide = 1, /// <summary> /// Panes are shown top-bottom. /// </summary> Tall = 2, }
TwoPaneViewMode
csharp
AvaloniaUI__Avalonia
src/Avalonia.Controls/ListBoxItem.cs
{ "start": 380, "end": 5007 }
public class ____ : ContentControl, ISelectable { /// <summary> /// Defines the <see cref="IsSelected"/> property. /// </summary> public static readonly StyledProperty<bool> IsSelectedProperty = SelectingItemsControl.IsSelectedProperty.AddOwner<ListBoxItem>(); private static readonly Point s_invalidPoint = new Point(double.NaN, double.NaN); private Point _pointerDownPoint = s_invalidPoint; /// <summary> /// Initializes static members of the <see cref="ListBoxItem"/> class. /// </summary> static ListBoxItem() { SelectableMixin.Attach<ListBoxItem>(IsSelectedProperty); PressedMixin.Attach<ListBoxItem>(); FocusableProperty.OverrideDefaultValue<ListBoxItem>(true); AutomationProperties.IsOffscreenBehaviorProperty.OverrideDefaultValue<ListBoxItem>(IsOffscreenBehavior.FromClip); } /// <summary> /// Gets or sets the selection state of the item. /// </summary> public bool IsSelected { get => GetValue(IsSelectedProperty); set => SetValue(IsSelectedProperty, value); } protected override AutomationPeer OnCreateAutomationPeer() { return new ListItemAutomationPeer(this); } protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); _pointerDownPoint = s_invalidPoint; if (e.Handled) return; if (!e.Handled && ItemsControl.ItemsControlFromItemContainer(this) is ListBox owner) { var p = e.GetCurrentPoint(this); if (p.Properties.PointerUpdateKind is PointerUpdateKind.LeftButtonPressed or PointerUpdateKind.RightButtonPressed) { if (p.Pointer.Type == PointerType.Mouse || (p.Pointer.Type == PointerType.Pen && p.Properties.IsRightButtonPressed)) { // If the pressed point comes from a mouse or right-click pen, perform the selection immediately. // In case of pen, only right-click is accepted, as left click (a tip touch) is used for scrolling. e.Handled = owner.UpdateSelectionFromPointerEvent(this, e); } else { // Otherwise perform the selection when the pointer is released as to not // interfere with gestures. _pointerDownPoint = p.Position; // Ideally we'd set handled here, but that would prevent the scroll gesture // recognizer from working. ////e.Handled = true; } } } } protected override void OnPointerReleased(PointerReleasedEventArgs e) { base.OnPointerReleased(e); if (!e.Handled && !double.IsNaN(_pointerDownPoint.X) && e.InitialPressMouseButton is MouseButton.Left or MouseButton.Right) { var point = e.GetCurrentPoint(this); var settings = TopLevel.GetTopLevel(e.Source as Visual)?.PlatformSettings; var tapSize = settings?.GetTapSize(point.Pointer.Type) ?? new Size(4, 4); var tapRect = new Rect(_pointerDownPoint, new Size()) .Inflate(new Thickness(tapSize.Width, tapSize.Height)); if (new Rect(Bounds.Size).ContainsExclusive(point.Position) && tapRect.ContainsExclusive(point.Position) && ItemsControl.ItemsControlFromItemContainer(this) is ListBox owner) { if (owner.UpdateSelectionFromPointerEvent(this, e)) { // As we only update selection from touch/pen on pointer release, we need to raise // the pointer event on the owner to trigger a commit. if (e.Pointer.Type != PointerType.Mouse) { var sourceBackup = e.Source; owner.RaiseEvent(e); e.Source = sourceBackup; } e.Handled = true; } } } _pointerDownPoint = s_invalidPoint; } } }
ListBoxItem
csharp
abpframework__abp
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/FeaturesModal.cshtml.cs
{ "start": 325, "end": 1543 }
public class ____ : CmsKitAdminPageModel { [BindProperty(SupportsGet = true)] [HiddenInput] public Guid BlogId { get; set; } [BindProperty] public List<BlogFeatureViewModel> Items { get; set; } protected IBlogFeatureAdminAppService BlogFeatureAdminAppService { get; } public FeaturesModalModel(IBlogFeatureAdminAppService blogFeatureAdminAppService) { BlogFeatureAdminAppService = blogFeatureAdminAppService; } public async Task OnGetAsync() { var blogFeatureDtos = await BlogFeatureAdminAppService.GetListAsync(BlogId); //Sort by localized feature name blogFeatureDtos.Sort((x, y) => string.Compare(L[x.FeatureName].Value, L[y.FeatureName].Value, StringComparison.CurrentCultureIgnoreCase)); Items = ObjectMapper.Map<List<BlogFeatureDto>, List<BlogFeatureViewModel>>(blogFeatureDtos); } public async Task<IActionResult> OnPostAsync() { var dtos = ObjectMapper.Map<List<BlogFeatureViewModel>, List<BlogFeatureInputDto>>(Items); foreach (var item in dtos) { await BlogFeatureAdminAppService.SetAsync(BlogId, item); } return NoContent(); }
FeaturesModalModel
csharp
dotnet__aspnetcore
src/Servers/IIS/IIS/src/Core/IISHttpContext.IHttpRequestIdentifierFeature.cs
{ "start": 269, "end": 1292 }
internal partial class ____ : IHttpRequestIdentifierFeature { string IHttpRequestIdentifierFeature.TraceIdentifier { get { if (TraceIdentifier == null) { InitializeHttpRequestIdentifierFeature(); } return TraceIdentifier; } set => TraceIdentifier = value; } [MemberNotNull(nameof(TraceIdentifier))] private unsafe void InitializeHttpRequestIdentifierFeature() { // Copied from WebListener // This is the base GUID used by HTTP.SYS for generating the activity ID. // HTTP.SYS overwrites the first 8 bytes of the base GUID with RequestId to generate ETW activity ID. // The requestId should be set by the NativeRequestContext var guid = new Guid(0xffcb4c93, 0xa57f, 0x453c, 0xb6, 0x3f, 0x84, 0x71, 0xc, 0x79, 0x67, 0xbb); *((ulong*)&guid) = RequestId; // TODO: Also make this not slow TraceIdentifier = guid.ToString(); } }
IISHttpContext
csharp
MaterialDesignInXAML__MaterialDesignInXamlToolkit
tests/MaterialDesignThemes.UITests/Samples/DialogHost/ClosingEventViewModel.cs
{ "start": 141, "end": 430 }
public partial class ____ : ObservableObject { [ObservableProperty] private bool _dialogIsOpen; [RelayCommand] private void OpenDialog() => DialogIsOpen = true; [RelayCommand] private void CloseDialog() => DialogIsOpen = false; }
ClosingEventViewModel
csharp
nopSolutions__nopCommerce
src/Plugins/Nop.Plugin.Widgets.GoogleAnalytics/GoogleAnalyticsPlugin.cs
{ "start": 382, "end": 7016 }
public class ____ : BasePlugin, IWidgetPlugin { #region Fields protected readonly ILocalizationService _localizationService; protected readonly INopUrlHelper _nopUrlHelper; protected readonly ISettingService _settingService; protected readonly WidgetSettings _widgetSettings; #endregion #region Ctor public GoogleAnalyticsPlugin(ILocalizationService localizationService, INopUrlHelper nopUrlHelper, ISettingService settingService, WidgetSettings widgetSettings) { _localizationService = localizationService; _nopUrlHelper = nopUrlHelper; _settingService = settingService; _widgetSettings = widgetSettings; } #endregion #region Methods /// <summary> /// Gets widget zones where this widget should be rendered /// </summary> /// <returns> /// A task that represents the asynchronous operation /// The task result contains the widget zones /// </returns> public Task<IList<string>> GetWidgetZonesAsync() { return Task.FromResult<IList<string>>(new List<string> { PublicWidgetZones.HeadHtmlTag }); } /// <summary> /// Gets a configuration page URL /// </summary> public override string GetConfigurationPageUrl() { return _nopUrlHelper.RouteUrl(GoogleAnalyticsDefaults.ConfigurationRouteName); } /// <summary> /// Gets a type of a view component for displaying widget /// </summary> /// <param name="widgetZone">Name of the widget zone</param> /// <returns>View component type</returns> public Type GetWidgetViewComponent(string widgetZone) { ArgumentNullException.ThrowIfNull(widgetZone); if (widgetZone.Equals(PublicWidgetZones.HeadHtmlTag)) return typeof(WidgetsGoogleAnalyticsViewComponent); return null; } /// <summary> /// Install plugin /// </summary> /// <returns>A task that represents the asynchronous operation</returns> public override async Task InstallAsync() { var settings = new GoogleAnalyticsSettings { GoogleId = "G-XXXXXXXXXX", TrackingScript = @"<!-- Global site tag (gtag.js) - Google Analytics --> <script async src='https://www.googletagmanager.com/gtag/js?id={GOOGLEID}'></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '{GOOGLEID}'); {CUSTOMER_TRACKING} </script>" }; await _settingService.SaveSettingAsync(settings); if (!_widgetSettings.ActiveWidgetSystemNames.Contains(GoogleAnalyticsDefaults.SystemName)) { _widgetSettings.ActiveWidgetSystemNames.Add(GoogleAnalyticsDefaults.SystemName); await _settingService.SaveSettingAsync(_widgetSettings); } await _localizationService.AddOrUpdateLocaleResourceAsync(new Dictionary<string, string> { ["Plugins.Widgets.GoogleAnalytics.UseSandbox"] = "UseSandbox", ["Plugins.Widgets.GoogleAnalytics.UseSandbox.Hint"] = "Determine whether to use the sandbox environment for testing purposes. This setting only applies to sending eCommerce information via the Measurement Protocol.", ["Plugins.Widgets.GoogleAnalytics.GoogleId"] = "ID", ["Plugins.Widgets.GoogleAnalytics.GoogleId.Hint"] = "Enter Google Analytics ID.", ["Plugins.Widgets.GoogleAnalytics.ApiSecret"] = "API Secret", ["Plugins.Widgets.GoogleAnalytics.ApiSecret.Hint"] = "Enter API Secret.", ["Plugins.Widgets.GoogleAnalytics.TrackingScript"] = "Tracking code", ["Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint"] = "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {CUSTOMER_TRACKING} will be dynamically replaced.", ["Plugins.Widgets.GoogleAnalytics.EnableEcommerce"] = "Enable eCommerce", ["Plugins.Widgets.GoogleAnalytics.EnableEcommerce.Hint"] = "Check to pass information about orders to Google eCommerce feature.", ["Plugins.Widgets.GoogleAnalytics.IncludeCustomerId"] = "Include customer ID", ["Plugins.Widgets.GoogleAnalytics.IncludeCustomerId.Hint"] = "Check to include customer identifier to script.", ["Plugins.Widgets.GoogleAnalytics.IncludingTax"] = "Include tax", ["Plugins.Widgets.GoogleAnalytics.IncludingTax.Hint"] = "Check to include tax when generating tracking code for eCommerce part.", ["Plugins.Widgets.GoogleAnalytics.Instructions"] = "<p>Google Analytics is a free website stats tool from Google. It keeps track of statistics about the visitors and eCommerce conversion on your website.<br /><br />Follow the next steps to enable Google Analytics integration:<br /><ul><li><a href=\"http://www.google.com/analytics/\" target=\"_blank\">Create a Google Analytics account</a> and follow the wizard to add your website</li><li>Copy the <b>MEASUREMENT ID</b> into the <b>ID</b> box below</li><li>In Google Analytics click on the <b>Measurement Protocol API secrets</b> under <b>Events</b></li><li>Click on <b>Create</b> button and follow the instructions to create a new API secret</li><li>Copy the API secret into the <b>API Secret</b> box below</li><li>Click the 'Save' button below and Google Analytics will be integrated into your store</li></ul><br /></p>" }); await base.InstallAsync(); } /// <summary> /// Uninstall plugin /// </summary> /// <returns>A task that represents the asynchronous operation</returns> public override async Task UninstallAsync() { //settings if (_widgetSettings.ActiveWidgetSystemNames.Contains(GoogleAnalyticsDefaults.SystemName)) { _widgetSettings.ActiveWidgetSystemNames.Remove(GoogleAnalyticsDefaults.SystemName); await _settingService.SaveSettingAsync(_widgetSettings); } await _settingService.DeleteSettingAsync<GoogleAnalyticsSettings>(); //locales await _localizationService.DeleteLocaleResourcesAsync("Plugins.Widgets.GoogleAnalytics"); await base.UninstallAsync(); } #endregion #region Properties /// <summary> /// Gets a value indicating whether to hide this plugin on the widget list page in the admin area /// </summary> public bool HideInWidgetList => false; #endregion }
GoogleAnalyticsPlugin
csharp
smartstore__Smartstore
src/Smartstore.Core/Content/Menus/SmartDbContext.Menus.cs
{ "start": 76, "end": 239 }
public partial class ____ { public DbSet<MenuEntity> Menus { get; set; } public DbSet<MenuItemEntity> MenuItems { get; set; } } }
SmartDbContext
csharp
MassTransit__MassTransit
src/MassTransit/SagaStateMachine/Configuration/StateMachineRequestConfigurator.cs
{ "start": 1413, "end": 1802 }
public class ____<TInstance, TRequest, TResponse, TResponse2> : StateMachineRequestConfigurator<TInstance, TRequest, TResponse>, IRequestConfigurator<TInstance, TRequest, TResponse, TResponse2>, RequestSettings<TInstance, TRequest, TResponse, TResponse2> where TInstance : class, SagaStateMachineInstance where TRequest :
StateMachineRequestConfigurator
csharp
unoplatform__uno
src/Uno.UI.RuntimeTests/MUX/Helpers/EventTester.cs
{ "start": 992, "end": 1240 }
public static class ____ { public static readonly TimeSpan Default_Timeout = TimeSpan.FromSeconds(5); public static readonly TimeSpan BVT_Timeout = TimeSpan.FromMinutes(2); public static TimeSpan Timeout = Default_Timeout; }
EventTesterConfig
csharp
dotnet__aspnetcore
src/Features/JsonPatch.SystemTextJson/test/TestObjectModels/NestedObject.cs
{ "start": 196, "end": 322 }
public class ____ { public string StringProperty { get; set; } public dynamic DynamicProperty { get; set; } }
NestedObject
csharp
ServiceStack__ServiceStack
ServiceStack.Blazor/tests/UI.Gallery/Gallery.Server/ServiceModel/Chinook.cs
{ "start": 13787, "end": 14034 }
public class ____ : IReturn<IdResponse>, IPut, IUpdateDb<Artists> { public long ArtistId { get; set; } public string Name { get; set; } } [Route("/customers/{CustomerId}", "PUT"), Tag(Tags.Store)]
UpdateArtists
csharp
dotnet__aspnetcore
src/Mvc/Mvc.Core/src/Filters/ControllerResultFilter.cs
{ "start": 342, "end": 1817 }
internal sealed class ____ : IAsyncResultFilter, IOrderedFilter { // Controller-filter methods run farthest from the result by default. /// <inheritdoc /> public int Order { get; set; } = int.MinValue; /// <inheritdoc /> public Task OnResultExecutionAsync( ResultExecutingContext context, ResultExecutionDelegate next) { ArgumentNullException.ThrowIfNull(context); ArgumentNullException.ThrowIfNull(next); var controller = context.Controller; if (controller == null) { throw new InvalidOperationException(Resources.FormatPropertyOfTypeCannotBeNull( nameof(context.Controller), nameof(ResultExecutingContext))); } if (controller is IAsyncResultFilter asyncResultFilter) { return asyncResultFilter.OnResultExecutionAsync(context, next); } else if (controller is IResultFilter resultFilter) { return ExecuteResultFilter(context, next, resultFilter); } else { return next(); } } private static async Task ExecuteResultFilter( ResultExecutingContext context, ResultExecutionDelegate next, IResultFilter resultFilter) { resultFilter.OnResultExecuting(context); if (!context.Cancel) { resultFilter.OnResultExecuted(await next()); } } }
ControllerResultFilter
csharp
cake-build__cake
src/Cake.Common.Tests/Unit/Build/AzurePipelines/Data/AzurePipelinesInfoTests.cs
{ "start": 3022, "end": 3469 }
public sealed class ____ { [Fact] public void Should_Return_Correct_Value() { // Given var info = new AzurePipelinesInfoFixture().CreateBuildInfo(); // When var result = info.AccessToken; // Then Assert.Equal("f662dbe218144c86bdecb1e9b2eb336c", result); } }
TheAccessTokenProperty
csharp
dotnet__reactive
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToObservable.cs
{ "start": 9514, "end": 9966 }
private sealed class ____ : IAsyncEnumerator<int> { private readonly Exception _exception; public ThrowOnCurrentAsyncEnumerator(Exception ex) { _exception = ex; } public int Current => throw _exception; public ValueTask DisposeAsync() => default; public ValueTask<bool> MoveNextAsync() => new(true); } } }
ThrowOnCurrentAsyncEnumerator
csharp
nopSolutions__nopCommerce
src/Tests/Nop.Tests/Nop.Services.Tests/ExportImport/ExportManagerTests.cs
{ "start": 773, "end": 22718 }
public class ____ : ServiceTest { #region Fields private CustomerSettings _customerSettings; private CatalogSettings _catalogSettings; private IAddressService _addressService; private ICategoryService _categoryService; private ICountryService _countryService; private ICustomerService _customerService; private IDateRangeService _dateRangeService; private IExportManager _exportManager; private ILanguageService _languageService; private IManufacturerService _manufacturerService; private IMeasureService _measureService; private IOrderService _orderService; private IProductTemplateService _productTemplateService; private IRepository<Product> _productRepository; private ITaxCategoryService _taxCategoryService; private IVendorService _vendorService; private ProductEditorSettings _productEditorSettings; #endregion #region Setup [OneTimeSetUp] public async Task SetUp() { _customerSettings = GetService<CustomerSettings>(); _catalogSettings = GetService<CatalogSettings>(); _addressService = GetService<IAddressService>(); _categoryService = GetService<ICategoryService>(); _countryService = GetService<ICountryService>(); _customerService = GetService<ICustomerService>(); _dateRangeService = GetService<IDateRangeService>(); _exportManager = GetService<IExportManager>(); _languageService = GetService<ILanguageService>(); _manufacturerService = GetService<IManufacturerService>(); _measureService = GetService<IMeasureService>(); _orderService = GetService<IOrderService>(); _productTemplateService = GetService<IProductTemplateService>(); _productRepository = GetService<IRepository<Product>>(); _taxCategoryService = GetService<ITaxCategoryService>(); _vendorService = GetService<IVendorService>(); await GetService<IGenericAttributeService>() .SaveAttributeAsync(await _customerService.GetCustomerByEmailAsync(NopTestsDefaults.AdminEmail), "category-advanced-mode", true); await GetService<IGenericAttributeService>() .SaveAttributeAsync(await _customerService.GetCustomerByEmailAsync(NopTestsDefaults.AdminEmail), "manufacturer-advanced-mode", true); await GetService<IGenericAttributeService>() .SaveAttributeAsync(await _customerService.GetCustomerByEmailAsync(NopTestsDefaults.AdminEmail), "product-advanced-mode", true); _productEditorSettings = GetService<ProductEditorSettings>(); } [OneTimeTearDown] public async Task TearDown() { await GetService<IGenericAttributeService>() .SaveAttributeAsync(await _customerService.GetCustomerByEmailAsync(NopTestsDefaults.AdminEmail), "category-advanced-mode", false); await GetService<IGenericAttributeService>() .SaveAttributeAsync(await _customerService.GetCustomerByEmailAsync(NopTestsDefaults.AdminEmail), "manufacturer-advanced-mode", false); await GetService<IGenericAttributeService>() .SaveAttributeAsync(await _customerService.GetCustomerByEmailAsync(NopTestsDefaults.AdminEmail), "product-advanced-mode", false); } #endregion #region Utilities protected static T PropertiesShouldEqual<T, Tp>(T actual, PropertyManager<Tp> manager, IDictionary<string, string> replacePairs, params string[] filter) { var objectProperties = typeof(T).GetProperties(); foreach (var property in manager.GetDefaultProperties) { if (filter.Contains(property.PropertyName)) continue; var objectProperty = replacePairs.TryGetValue(property.PropertyName, out var value) ? objectProperties.FirstOrDefault(p => p.Name == value) : objectProperties.FirstOrDefault(p => p.Name == property.PropertyName); if (objectProperty == null) continue; var objectPropertyValue = objectProperty.GetValue(actual); var propertyValue = property.PropertyValue; if (propertyValue is XLCellValue { IsBlank: true }) propertyValue = null; if (string.IsNullOrEmpty(propertyValue?.ToString() ?? string.Empty) && objectPropertyValue is null) continue; switch (objectPropertyValue) { case int: propertyValue = property.IntValue; break; case Guid: propertyValue = property.GuidValue; break; case string: propertyValue = property.StringValue; break; case DateTime time: ; objectPropertyValue = new DateTime(time.Year, time.Month, time.Day, time.Hour, time.Minute, time.Second); if (DateTime.TryParse(property.StringValue, out var date)) propertyValue = date; else propertyValue = null; break; case bool: propertyValue = property.BooleanValue; break; case decimal: propertyValue = property.DecimalValue; break; } if (objectProperty.PropertyType.IsEnum && objectPropertyValue != null) { objectPropertyValue = (int)objectPropertyValue; propertyValue = property.IntValue; } propertyValue.Should().Be(objectPropertyValue, $"The property \"{typeof(T).Name}.{property.PropertyName}\" of these objects is not equal"); } return actual; } protected async Task<PropertyManager<T>> GetPropertyManagerAsync<T>(XLWorkbook workbook) { var languages = await _languageService.GetAllLanguagesAsync(); //the columns var metadata = ImportManager.GetWorkbookMetadata<T>(workbook, languages); var defaultProperties = metadata.DefaultProperties; var localizedProperties = metadata.LocalizedProperties; return new PropertyManager<T>(defaultProperties, _catalogSettings, localizedProperties); } protected XLWorkbook GetWorkbook(byte[] excelData) { var stream = new MemoryStream(excelData); return new XLWorkbook(stream); } protected T AreAllObjectPropertiesPresent<T>(T obj, PropertyManager<T> manager, params string[] filters) { foreach (var propertyInfo in typeof(T).GetProperties()) { if (filters.Contains(propertyInfo.Name)) continue; if (manager.GetDefaultProperties.Any(p => p.PropertyName == propertyInfo.Name)) continue; Assert.Fail($"The property \"{typeof(T).Name}.{propertyInfo.Name}\" no present on excel file"); } return obj; } #endregion #region Test export to excel [Test] public async Task CanExportOrdersXlsx() { var orders = await _orderService.SearchOrdersAsync(); var excelData = await _exportManager.ExportOrdersToXlsxAsync(orders); var workbook = GetWorkbook(excelData); var manager = await GetPropertyManagerAsync<Order>(workbook); // get the first worksheet in the workbook var worksheet = workbook.Worksheets.FirstOrDefault() ?? throw new NopException("No worksheet found"); manager.ReadDefaultFromXlsx(worksheet, 2); var replacePairs = new Dictionary<string, string> { { "OrderId", "Id" }, { "OrderStatus", "OrderStatusId" }, { "PaymentStatus", "PaymentStatusId" }, { "ShippingStatus", "ShippingStatusId" }, { "ShippingPickupInStore", "PickupInStore" } }; var order = orders.First(); var ignore = new List<string>(); ignore.AddRange(replacePairs.Values); //not exported fields ignore.AddRange(new[] { "BillingAddressId", "ShippingAddressId", "PickupAddressId", "CustomerTaxDisplayTypeId", "RewardPointsHistoryEntryId", "CheckoutAttributeDescription", "CheckoutAttributesXml", "CustomerLanguageId", "CustomerIp", "AllowStoringCreditCardNumber", "CardType", "CardName", "CardNumber", "MaskedCreditCardNumber", "CardCvv2", "CardExpirationMonth", "CardExpirationYear", "AuthorizationTransactionId", "AuthorizationTransactionCode", "AuthorizationTransactionResult", "CaptureTransactionId", "CaptureTransactionResult", "SubscriptionTransactionId", "PaidDateUtc", "Deleted", "PickupAddress", "RedeemedRewardPointsEntryId", "DiscountUsageHistory", "GiftCardUsageHistory", "OrderNotes", "OrderItems", "Shipments", "OrderStatus", "PaymentStatus", "ShippingStatus", "CustomerTaxDisplayType", "CustomOrderNumber" }); //fields tested individually ignore.AddRange(new[] { "Customer", "BillingAddressId", "ShippingAddressId", "EntityCacheKey" }); manager.SetSelectList("OrderStatus", await OrderStatus.Pending.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("PaymentStatus", await PaymentStatus.Pending.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("ShippingStatus", await ShippingStatus.ShippingNotRequired.ToSelectListAsync(useLocalization: false)); AreAllObjectPropertiesPresent(order, manager, ignore.ToArray()); PropertiesShouldEqual(order, manager, replacePairs); var addressFields = new List<string> { "FirstName", "LastName", "Email", "Company", "Country", "StateProvince", "City", "County", "Address1", "Address2", "ZipPostalCode", "PhoneNumber", "FaxNumber" }; const string billingPattern = "Billing"; replacePairs = addressFields.ToDictionary(p => billingPattern + p, p => p); var testBillingAddress = await _addressService.GetAddressByIdAsync(order.BillingAddressId); PropertiesShouldEqual(testBillingAddress, manager, replacePairs, "CreatedOnUtc", "BillingCountry"); var country = await _countryService.GetCountryByAddressAsync(testBillingAddress); manager.GetDefaultProperties.First(p => p.PropertyName == "BillingCountry").StringValue.Should().Be(country.Name); const string shippingPattern = "Shipping"; replacePairs = addressFields.ToDictionary(p => shippingPattern + p, p => p); var testShippingAddress = await _addressService.GetAddressByIdAsync(order.ShippingAddressId ?? 0); PropertiesShouldEqual(testShippingAddress, manager, replacePairs, "CreatedOnUtc", "ShippingCountry"); country = await _countryService.GetCountryByAddressAsync(testShippingAddress); manager.GetDefaultProperties.First(p => p.PropertyName == "ShippingCountry").StringValue.Should().Be(country.Name); } [Test] public async Task CanExportManufacturersXlsx() { var manufacturers = await _manufacturerService.GetAllManufacturersAsync(); var excelData = await _exportManager.ExportManufacturersToXlsxAsync(manufacturers); var workbook = GetWorkbook(excelData); var manager = await GetPropertyManagerAsync<Manufacturer>(workbook); // get the first worksheet in the workbook var worksheet = workbook.Worksheets.FirstOrDefault() ?? throw new NopException("No worksheet found"); manager.ReadDefaultFromXlsx(worksheet, 2); var manufacturer = manufacturers.First(); var ignore = new List<string> { "Picture", "EntityCacheKey", "PictureId", "SubjectToAcl", "LimitedToStores", "Deleted", "CreatedOnUtc", "UpdatedOnUtc", "AppliedDiscounts", "DiscountManufacturerMappings" }; AreAllObjectPropertiesPresent(manufacturer, manager, ignore.ToArray()); PropertiesShouldEqual(manufacturer, manager, new Dictionary<string, string>()); manager.GetDefaultProperties.First(p => p.PropertyName == "Picture").PropertyValue.Should().NotBeNull(); } [Test] public async Task CanExportCustomersToXlsx() { var customers = await _customerService.GetAllCustomersAsync(); var excelData = await _exportManager.ExportCustomersToXlsxAsync(customers); var workbook = GetWorkbook(excelData); var manager = await GetPropertyManagerAsync<Customer>(workbook); // get the first worksheet in the workbook var worksheet = workbook.Worksheets.FirstOrDefault() ?? throw new NopException("No worksheet found"); manager.ReadDefaultFromXlsx(worksheet, 2); manager.SetSelectList("VatNumberStatus", await VatNumberStatus.Unknown.ToSelectListAsync(useLocalization: false)); var customer = customers.First(); var ignore = new List<string> { "Id", "ExternalAuthenticationRecords", "ShoppingCartItems", "ReturnRequests", "BillingAddress", "ShippingAddress", "Addresses", "AdminComment", "EmailToRevalidate", "HasShoppingCartItems", "RequireReLogin", "FailedLoginAttempts", "CannotLoginUntilDateUtc", "Deleted", "IsSystemAccount", "SystemName", "LastIpAddress", "LastLoginDateUtc", "LastActivityDateUtc", "RegisteredInStoreId", "BillingAddressId", "ShippingAddressId", "CustomerCustomerRoleMappings", "CustomerAddressMappings", "EntityCacheKey", "VendorId", "DateOfBirth", "CountryId", "StateProvinceId", "VatNumberStatusId", "TimeZoneId", "CurrencyId", "LanguageId", "TaxDisplayTypeId", "TaxDisplayType", "TaxDisplayType", "VatNumberStatusId", "MustChangePassword" }; if (!_customerSettings.FirstNameEnabled) ignore.Add("FirstName"); if (!_customerSettings.LastNameEnabled) ignore.Add("LastName"); if (!_customerSettings.GenderEnabled) ignore.Add("Gender"); if (!_customerSettings.CompanyEnabled) ignore.Add("Company"); if (!_customerSettings.StreetAddressEnabled) ignore.Add("StreetAddress"); if (!_customerSettings.StreetAddress2Enabled) ignore.Add("StreetAddress2"); if (!_customerSettings.ZipPostalCodeEnabled) ignore.Add("ZipPostalCode"); if (!_customerSettings.CityEnabled) ignore.Add("City"); if (!_customerSettings.CountyEnabled) ignore.Add("County"); if (!_customerSettings.CountryEnabled) ignore.Add("Country"); if (!_customerSettings.StateProvinceEnabled) ignore.Add("StateProvince"); if (!_customerSettings.PhoneEnabled) ignore.Add("Phone"); if (!_customerSettings.FaxEnabled) ignore.Add("Fax"); AreAllObjectPropertiesPresent(customer, manager, ignore.ToArray()); PropertiesShouldEqual(customer, manager, new Dictionary<string, string>()); } [Test] public async Task CanExportCategoriesToXlsx() { var categories = await _categoryService.GetAllCategoriesAsync(); var excelData = await _exportManager.ExportCategoriesToXlsxAsync(categories); var workbook = GetWorkbook(excelData); var manager = await GetPropertyManagerAsync<Category>(workbook); // get the first worksheet in the workbook var worksheet = workbook.Worksheets.FirstOrDefault() ?? throw new NopException("No worksheet found"); manager.ReadDefaultFromXlsx(worksheet, 2); var category = categories.First(); var ignore = new List<string> { "CreatedOnUtc", "EntityCacheKey", "Picture", "PictureId", "AppliedDiscounts", "UpdatedOnUtc", "SubjectToAcl", "LimitedToStores", "Deleted", "DiscountCategoryMappings", "RestrictFromVendors" }; AreAllObjectPropertiesPresent(category, manager, ignore.ToArray()); PropertiesShouldEqual(category, manager, new Dictionary<string, string>()); manager.GetDefaultProperties.First(p => p.PropertyName == "Picture").PropertyValue.Should().NotBeNull(); } [Test] public async Task CanExportProductsToXlsx() { var replacePairs = new Dictionary<string, string> { { "ProductId", "Id" }, { "ProductType", "ProductTypeId" }, { "GiftCardType", "GiftCardTypeId" }, { "Vendor", "VendorId" }, { "ProductTemplate", "ProductTemplateId" }, { "DeliveryDate", "DeliveryDateId" }, { "TaxCategory", "TaxCategoryId" }, { "ManageInventoryMethod", "ManageInventoryMethodId" }, { "ProductAvailabilityRange", "ProductAvailabilityRangeId" }, { "LowStockActivity", "LowStockActivityId" }, { "BackorderMode", "BackorderModeId" }, { "BasepriceUnit", "BasepriceUnitId" }, { "BasepriceBaseUnit", "BasepriceBaseUnitId" }, { "SKU", "Sku" }, { "DownloadActivationType", "DownloadActivationTypeId" }, { "RecurringCyclePeriod", "RecurringCyclePeriodId" }, { "RentalPricePeriod", "RentalPricePeriodId" } }; var ignore = new List<string> { "Categories", "Manufacturers", "AdminComment", "ProductType", "BackorderMode", "DownloadActivationType", "GiftCardType", "LowStockActivity", "ManageInventoryMethod", "RecurringCyclePeriod", "RentalPricePeriod", "ProductCategories", "ProductManufacturers", "ProductPictures", "ProductReviews", "ProductSpecificationAttributes", "ProductTags", "ProductAttributeMappings", "ProductAttributeCombinations", "TierPrices", "AppliedDiscounts", "ProductWarehouseInventory", "ApprovedRatingSum", "NotApprovedRatingSum", "ApprovedTotalReviews", "NotApprovedTotalReviews", "SubjectToAcl", "LimitedToStores", "Deleted", "DownloadExpirationDays", "AvailableStartDateTimeUtc", "AvailableEndDateTimeUtc", "DisplayOrder", "CreatedOnUtc", "UpdatedOnUtc", "ProductProductTagMappings", "DiscountProductMappings", "EntityCacheKey" }; ignore.AddRange(replacePairs.Values); var product = _productRepository.Table.ToList().First(); var excelData = await _exportManager.ExportProductsToXlsxAsync(new[] { product }); var workbook = GetWorkbook(excelData); var manager = await GetPropertyManagerAsync<Product>(workbook); // get the first worksheet in the workbook var worksheet = workbook.Worksheets.FirstOrDefault() ?? throw new NopException("No worksheet found"); manager.SetSelectList("ProductType", await ProductType.SimpleProduct.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("GiftCardType", await GiftCardType.Virtual.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("DownloadActivationType", await DownloadActivationType.Manually.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("ManageInventoryMethod", await ManageInventoryMethod.DontManageStock.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("LowStockActivity", await LowStockActivity.Nothing.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("BackorderMode", await BackorderMode.NoBackorders.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("RecurringCyclePeriod", await RecurringProductCyclePeriod.Days.ToSelectListAsync(useLocalization: false)); manager.SetSelectList("RentalPricePeriod", await RentalPricePeriod.Days.ToSelectListAsync(useLocalization: false)); var vendors = await _vendorService.GetAllVendorsAsync(showHidden: true); manager.SetSelectList("Vendor", vendors.Select(v => v as BaseEntity).ToSelectList(p => (p as Vendor)?.Name ?? string.Empty)); var templates = await _productTemplateService.GetAllProductTemplatesAsync(); manager.SetSelectList("ProductTemplate", templates.Select(pt => pt as BaseEntity).ToSelectList(p => (p as ProductTemplate)?.Name ?? string.Empty)); var dates = await _dateRangeService.GetAllDeliveryDatesAsync(); manager.SetSelectList("DeliveryDate", dates.Select(dd => dd as BaseEntity).ToSelectList(p => (p as DeliveryDate)?.Name ?? string.Empty)); var availabilityRanges = await _dateRangeService.GetAllProductAvailabilityRangesAsync(); manager.SetSelectList("ProductAvailabilityRange", availabilityRanges.Select(range => range as BaseEntity).ToSelectList(p => (p as ProductAvailabilityRange)?.Name ?? string.Empty)); var categories = await _taxCategoryService.GetAllTaxCategoriesAsync(); manager.SetSelectList("TaxCategory", categories.Select(tc => tc as BaseEntity).ToSelectList(p => (p as TaxCategory)?.Name ?? string.Empty)); var measureWeights = await _measureService.GetAllMeasureWeightsAsync(); manager.SetSelectList("BasepriceUnit", measureWeights.Select(mw => mw as BaseEntity).ToSelectList(p => (p as MeasureWeight)?.Name ?? string.Empty)); manager.SetSelectList("BasepriceBaseUnit", measureWeights.Select(mw => mw as BaseEntity).ToSelectList(p => (p as MeasureWeight)?.Name ?? string.Empty)); manager.Remove("ProductTags"); manager.ReadDefaultFromXlsx(worksheet, 2); AreAllObjectPropertiesPresent(product, manager, ignore.ToArray()); PropertiesShouldEqual(product, manager, replacePairs); } #endregion }
ExportManagerTests
csharp
unoplatform__uno
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Controls/PasswordBox_Focus_Leak.xaml.cs
{ "start": 339, "end": 656 }
partial class ____ : UserControl { public PasswordBox_Focus_Leak() { this.InitializeComponent(); Loaded += PasswordBox_Focus_Leak_Loaded; } private void PasswordBox_Focus_Leak_Loaded(object sender, RoutedEventArgs e) { TestPasswordBox.Focus(FocusState.Programmatic); } } }
PasswordBox_Focus_Leak
csharp
unoplatform__uno
src/Uno.UWP/Generated/3.0.0.0/Windows.Devices.Sensors/Magnetometer.cs
{ "start": 258, "end": 8694 }
public partial class ____ { #if false || false || __TVOS__ || IS_UNIT_TESTS || false || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__TVOS__", "IS_UNIT_TESTS", "__SKIA__", "__NETSTD_REFERENCE__")] public uint ReportInterval { get { throw new global::System.NotImplementedException("The member uint Magnetometer.ReportInterval is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=uint%20Magnetometer.ReportInterval"); } set { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Sensors.Magnetometer", "uint Magnetometer.ReportInterval"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public uint MinimumReportInterval { get { throw new global::System.NotImplementedException("The member uint Magnetometer.MinimumReportInterval is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=uint%20Magnetometer.MinimumReportInterval"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public global::Windows.Graphics.Display.DisplayOrientations ReadingTransform { get { throw new global::System.NotImplementedException("The member DisplayOrientations Magnetometer.ReadingTransform is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=DisplayOrientations%20Magnetometer.ReadingTransform"); } set { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Sensors.Magnetometer", "DisplayOrientations Magnetometer.ReadingTransform"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public uint ReportLatency { get { throw new global::System.NotImplementedException("The member uint Magnetometer.ReportLatency is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=uint%20Magnetometer.ReportLatency"); } set { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Sensors.Magnetometer", "uint Magnetometer.ReportLatency"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public uint MaxBatchSize { get { throw new global::System.NotImplementedException("The member uint Magnetometer.MaxBatchSize is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=uint%20Magnetometer.MaxBatchSize"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public global::Windows.Devices.Sensors.MagnetometerDataThreshold ReportThreshold { get { throw new global::System.NotImplementedException("The member MagnetometerDataThreshold Magnetometer.ReportThreshold is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=MagnetometerDataThreshold%20Magnetometer.ReportThreshold"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public string DeviceId { get { throw new global::System.NotImplementedException("The member string Magnetometer.DeviceId is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=string%20Magnetometer.DeviceId"); } } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public global::Windows.Devices.Sensors.MagnetometerReading GetCurrentReading() { throw new global::System.NotImplementedException("The member MagnetometerReading Magnetometer.GetCurrentReading() is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=MagnetometerReading%20Magnetometer.GetCurrentReading%28%29"); } #endif // Forced skipping of method Windows.Devices.Sensors.Magnetometer.MinimumReportInterval.get // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReportInterval.set // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReportInterval.get // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReadingChanged.add // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReadingChanged.remove // Forced skipping of method Windows.Devices.Sensors.Magnetometer.DeviceId.get // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReadingTransform.set // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReadingTransform.get // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReportLatency.set // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReportLatency.get // Forced skipping of method Windows.Devices.Sensors.Magnetometer.MaxBatchSize.get // Forced skipping of method Windows.Devices.Sensors.Magnetometer.ReportThreshold.get #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public static string GetDeviceSelector() { throw new global::System.NotImplementedException("The member string Magnetometer.GetDeviceSelector() is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=string%20Magnetometer.GetDeviceSelector%28%29"); } #endif #if __ANDROID__ || __IOS__ || __TVOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "__TVOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__")] public static global::Windows.Foundation.IAsyncOperation<global::Windows.Devices.Sensors.Magnetometer> FromIdAsync(string deviceId) { throw new global::System.NotImplementedException("The member IAsyncOperation<Magnetometer> Magnetometer.FromIdAsync(string deviceId) is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=IAsyncOperation%3CMagnetometer%3E%20Magnetometer.FromIdAsync%28string%20deviceId%29"); } #endif // Skipping already declared method Windows.Devices.Sensors.Magnetometer.GetDefault() #if false || false || __TVOS__ || IS_UNIT_TESTS || false || __SKIA__ || __NETSTD_REFERENCE__ [global::Uno.NotImplemented("__TVOS__", "IS_UNIT_TESTS", "__SKIA__", "__NETSTD_REFERENCE__")] public event global::Windows.Foundation.TypedEventHandler<global::Windows.Devices.Sensors.Magnetometer, global::Windows.Devices.Sensors.MagnetometerReadingChangedEventArgs> ReadingChanged { [global::Uno.NotImplemented("__TVOS__", "IS_UNIT_TESTS", "__SKIA__", "__NETSTD_REFERENCE__")] add { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Sensors.Magnetometer", "event TypedEventHandler<Magnetometer, MagnetometerReadingChangedEventArgs> Magnetometer.ReadingChanged"); } [global::Uno.NotImplemented("__TVOS__", "IS_UNIT_TESTS", "__SKIA__", "__NETSTD_REFERENCE__")] remove { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Devices.Sensors.Magnetometer", "event TypedEventHandler<Magnetometer, MagnetometerReadingChangedEventArgs> Magnetometer.ReadingChanged"); } } #endif } }
Magnetometer
csharp
mongodb__mongo-csharp-driver
src/MongoDB.Driver/FindOptions.cs
{ "start": 5651, "end": 6557 }
record ____ should be added to the result document. /// </summary> public bool? ShowRecordId { get { return _showRecordId; } set { _showRecordId = value; } } /// <summary> /// Gets or sets the operation timeout. /// </summary> // TODO: CSOT: Make it public when CSOT will be ready for GA internal TimeSpan? Timeout { get => _timeout; set => _timeout = Ensure.IsNullOrValidTimeout(value, nameof(Timeout)); } /// <summary> /// Gets or sets the translation options. /// </summary> public ExpressionTranslationOptions TranslationOptions { get { return _translationOptions; } set { _translationOptions = value; } } } /// <summary> /// Options for finding documents. /// </summary>
Id
csharp
ChilliCream__graphql-platform
src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Builders/CodeLineBuilder.cs
{ "start": 59, "end": 1169 }
public class ____ : ICode { private bool _writeLine = true; private ICode? _value; private string? _sourceText; public static CodeLineBuilder New() => new CodeLineBuilder(); public static CodeLineBuilder From(string line) => New().SetLine(line); public CodeLineBuilder SetLine(string value) { _sourceText = value; _value = null; return this; } public CodeLineBuilder SetLine(ICode value) { _value = value; _sourceText = null; return this; } public CodeLineBuilder SetWriteLine(bool writeLine) { _writeLine = writeLine; return this; } public void Build(CodeWriter writer) { ArgumentNullException.ThrowIfNull(writer); if (_value is not null) { writer.WriteIndent(); _value.Build(writer); } else if (_sourceText is not null) { writer.WriteIndent(); writer.Write(_sourceText); } if (_writeLine) { writer.WriteLine(); } } }
CodeLineBuilder
csharp
MassTransit__MassTransit
tests/MassTransit.Tests/ContainerTests/RoutingSlipRequestProxy_Specs.cs
{ "start": 3409, "end": 5085 }
class ____ : RoutingSlipRequestProxy<RoutingRequest> { readonly IEndpointAddressProvider _endpointAddressProvider; public RoutingRequestConsumer(IEndpointAddressProvider endpointAddressProvider) { _endpointAddressProvider = endpointAddressProvider; } protected override async Task BuildRoutingSlip(RoutingSlipBuilder builder, ConsumeContext<RoutingRequest> request) { builder.AddActivity(nameof(TestActivity), _endpointAddressProvider.GetExecuteEndpoint<TestActivity, TestArguments>(), new { Value = "Hello", NullValue = (string)null }); builder.AddActivity(nameof(SecondTestActivity), _endpointAddressProvider.GetExecuteEndpoint<SecondTestActivity, TestArguments>(), new { Value = "Hello Again", NullValue = (string)null }); builder.AddActivity(nameof(FaultyActivity), _endpointAddressProvider.GetExecuteEndpoint<FaultyActivity, FaultyArguments>(), new { Value = "Hello Again", NullValue = (string)null }); } protected override Uri GetResponseEndpointAddress(ConsumeContext<RoutingRequest> context) { return _endpointAddressProvider.GetResponseConsumerEndpoint<RoutingResponseConsumer, RoutingRequest, RoutingResponse>(); } }
RoutingRequestConsumer
csharp
jellyfin__jellyfin
src/Jellyfin.LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
{ "start": 20765, "end": 20894 }
private class ____ : ChannelInfo { public bool IsLegacyTuner { get; set; } } } }
HdHomerunChannelInfo
csharp
mongodb__mongo-csharp-driver
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4509Tests.cs
{ "start": 2015, "end": 2076 }
public enum ____ { JobNumber, DriverName }
JobSortColumn
csharp
abpframework__abp
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Ratings/RatingConsts.cs
{ "start": 62, "end": 396 }
public static class ____ { public static int MaxEntityTypeLength { get; set; } = CmsEntityConsts.MaxEntityTypeLength; public static int MaxEntityIdLength { get; set; } = CmsEntityConsts.MaxEntityIdLength; public static int MaxStarCount { get; set; } = 5; public static int MinStarCount { get; set; } = 1; }
RatingConsts
csharp
abpframework__abp
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/PostWithDetailsDto.cs
{ "start": 214, "end": 840 }
public class ____ : FullAuditedEntityDto<Guid>, IHasConcurrencyStamp { public Guid BlogId { get; set; } public string Title { get; set; } public string CoverImage { get; set; } public string Url { get; set; } public string Content { get; set; } public string Description { get; set; } public int ReadCount { get; set; } public int CommentCount { get; set; } [CanBeNull] public BlogUserDto Writer { get; set; } public List<TagDto> Tags { get; set; } public string ConcurrencyStamp { get; set; } } }
PostWithDetailsDto
csharp
EventStore__EventStore
src/KurrentDB.Core/Messages/TcpClientMessageDto.cs
{ "start": 6617, "end": 6880 }
partial class ____ { public ReadEvent(string eventStreamId, long eventNumber, bool resolveLinkTos, bool requireLeader) { EventStreamId = eventStreamId; EventNumber = eventNumber; ResolveLinkTos = resolveLinkTos; RequireLeader = requireLeader; } }
ReadEvent