當前位置: 首頁>>代碼示例>>C#>>正文


C# Guid.Concat方法代碼示例

本文整理匯總了C#中System.Guid.Concat方法的典型用法代碼示例。如果您正苦於以下問題:C# Guid.Concat方法的具體用法?C# Guid.Concat怎麽用?C# Guid.Concat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Guid的用法示例。


在下文中一共展示了Guid.Concat方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Short_byte_arrays_are_not_truncated

        public void Short_byte_arrays_are_not_truncated()
        {
            var shortArray = new Guid("21EC2020-3AEA-4069-A2DD-08002B30309D").ToByteArray();
            var longerShortArray = shortArray.Concat(shortArray).ToArray();

            Assert.Equal("0x2020EC21EA3A6940A2DD08002B30309D", RelationalLoggerExtensions.FormatParameterValue(shortArray));
            Assert.Equal("0x2020EC21EA3A6940A2DD08002B30309D2020EC21EA3A6940A2DD08002B30309D", RelationalLoggerExtensions.FormatParameterValue(longerShortArray));
        }
開發者ID:ChuYuzhi,項目名稱:EntityFramework,代碼行數:8,代碼來源:RelationalLoggerExtensionsTest.cs

示例2: Long_byte_arrays_are_truncated

        public void Long_byte_arrays_are_truncated()
        {
            var shortArray = new Guid("21EC2020-3AEA-4069-A2DD-08002B30309D").ToByteArray();
            var longArray = shortArray.Concat(shortArray).Concat(shortArray).ToArray();

            var builder = new StringBuilder();
            RelationalLoggerExtensions.FormatParameterValue(builder, longArray);

            Assert.Equal("'0x2020EC21EA3A6940A2DD08002B30309D2020EC21EA3A6940A2DD08002B30309D...'", builder.ToString());
        }
開發者ID:RickyLin,項目名稱:EntityFramework,代碼行數:10,代碼來源:RelationalLoggerExtensionsTest.cs

示例3: MultipleOperations_CompletedOperations_Test

        public void MultipleOperations_CompletedOperations_Test()
        {
            IOperationsManager operationsManager = GetOperationsManager();

            int numberOfOperations = 500;
            Guid[] completed = new Guid[numberOfOperations];
            Guid[] running = new Guid[numberOfOperations];
            Guid[] failed = new Guid[numberOfOperations];
            Guid[] canceled = new Guid[numberOfOperations];
            Guid[] pendingCancelation = new Guid[numberOfOperations];
            for (int i = 0; i < numberOfOperations; i++)
            {
                completed[i] = operationsManager.RegistrOperation(OPERATION_DISPLAY_NAME);
                running[i] = operationsManager.RegistrOperation(OPERATION_DISPLAY_NAME);
                failed[i] = operationsManager.RegistrOperation(OPERATION_DISPLAY_NAME);
                canceled[i] = operationsManager.RegistrOperation(OPERATION_DISPLAY_NAME);
                pendingCancelation[i] = operationsManager.RegistrOperation(OPERATION_DISPLAY_NAME);
            }
            foreach (var guid in pendingCancelation)
            {
                operationsManager.SetOperationCancelFlag(guid);
            }
            foreach (var guid in completed)
            {
                operationsManager.SetOperationResult(guid, null);
            }
            foreach (var guid in failed)
            {
                operationsManager.SetOperationFailed(guid, new Exception(FAILURE_REASON));
            }
            foreach (var guid in canceled)
            {
                operationsManager.SetOperationCanceled(guid);
            }
            Guid[] completedOperations = operationsManager.GetCompletedOperations();
            CollectionAssert.AreEquivalent(completed.Concat(failed).Concat(canceled).ToArray(), completedOperations);
        }
開發者ID:huoxudong125,項目名稱:WcfEverywhere,代碼行數:37,代碼來源:IOperationsManager_TestFixture.cs

示例4: RemoveImportQueueRecordRange

 public GuidExecutionResults RemoveImportQueueRecordRange(Guid[] identifiers)
 {
     UpdateSessionCulture();
     using (var logSession = Helpers.Log.Session($"{GetType()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}()", VerboseLog, RaiseLog))
         try
         {
             using (var rep = GetNewRepository(logSession))
             {
                 logSession.Add($"Try to get account import queue records with ids = '{identifiers.Concat(i => i.ToString(), ",")}' from database...");
                 var itemsToRemove = rep.Get<RoyaltyRepository.Models.ImportQueueRecord>(a => identifiers.Contains(a.ImportQueueRecordUID)).ToArray();
                 logSession.Add($"Accounts import queue records found for remove: {itemsToRemove.Length}");
                 rep.RemoveRange(itemsToRemove);
                 rep.SaveChanges();
                 return new GuidExecutionResults(itemsToRemove.Select(i => i.ImportQueueRecordUID).ToArray());
             }
         }
         catch (Exception ex)
         {
             ex.Data.Add(nameof(identifiers), identifiers.Concat(i => i.ToString(),","));
             logSession.Enabled = true;
             logSession.Add(ex);
             return new GuidExecutionResults(ex);
         }
 }
開發者ID:kblc,項目名稱:Royalty,代碼行數:24,代碼來源:AccountService.ImportQueueRecord.cs

示例5: EmployeePhotosRemove

        /// <summary>
        /// Remove photo to employee
        /// </summary>
        /// <param name="employeeId">Employee identifier</param>
        /// <param name="photoIdentifier">Employee photo identifier</param>
        public Model.EmployeePhotoExecutionResults EmployeePhotosRemove(long employeeId, Guid[] photoIdentifiers)
        {
            UpdateSessionCulture();
            using (var logSession = Helpers.Log.Session($"{GetType()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}()", VerboseLog, RaiseLog))
                try
                {
                    var emp = EmployeeGet(employeeId);
                    if (emp.Exception != null)
                        throw emp.Exception;

                    using (var rep = GetNewRepository(logSession))
                    {
                        photoIdentifiers.ToList().ForEach(photoIdentifier => {
                            var dbPhoto = rep.Get<Repository.Model.EmployeePhoto>(e => e.FileId == photoIdentifier).SingleOrDefault();
                            if (dbPhoto == null)
                                throw new Exception(string.Format(Properties.Resources.FILESERVICE_FileNotFound, photoIdentifier));
                            rep.Remove(dbPhoto, saveAfterRemove: false);
                        });
                        rep.SaveChanges(true);
                    }

                    return EmployeePhotosGet(employeeId);
                }
                catch (Exception ex)
                {
                    ex.Data.Add(nameof(employeeId), employeeId);
                    ex.Data.Add(nameof(photoIdentifiers), photoIdentifiers.Concat(i => i.ToString(),", "));
                    logSession.Enabled = true;
                    logSession.Add(ex);
                    return new EmployeePhotoExecutionResults(ex);
                }
        }
開發者ID:kblc,項目名稱:Personnel,代碼行數:37,代碼來源:StuffingService.EmployeePhoto.cs

示例6: GetRange

 /// <summary>
 /// Get file infos by identifiers
 /// </summary>
 /// <param name="identifiers">File info identifiers</param>
 /// <returns>Files info</returns>
 public FileExecutionResults GetRange(Guid[] identifiers)
 {
     UpdateSessionCulture();
     using (var logSession = Helpers.Log.Session($"{GetType()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}()", VerboseLog, RaiseLog))
         try
         {
             using (var rep = GetNewRepository(logSession))
             {
                 var res = rep.Get<RoyaltyRepository.Models.File>(f => identifiers.Contains(f.FileUID))
                     .ToArray()
                     .Select(f => Mapper.Map<Model.File>(f))
                     .ToArray();
                 return new FileExecutionResults(res);
             }
         }
         catch (Exception ex)
         {
             ex.Data.Add(nameof(identifiers), identifiers.Concat(i => i.ToString("N"), ","));
             logSession.Enabled = true;
             logSession.Add(ex);
             return new FileExecutionResults(ex);
         }
 }
開發者ID:kblc,項目名稱:Royalty,代碼行數:28,代碼來源:FileService.cs


注:本文中的System.Guid.Concat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。