本文整理汇总了C#中System.Guid.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.Select方法的具体用法?C# Guid.Select怎么用?C# Guid.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Guid
的用法示例。
在下文中一共展示了Guid.Select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClientPath
/// <summary>
/// Converts a server-side entity path to a client-side entity path.
/// </summary>
/// <param name="path">
/// The server-side entity path.
/// </param>
/// <returns>
/// The client-side entity path.
/// </returns>
/// <remarks>
/// The client-side entity path expects an extra root ID of "-1",
/// which this method includes.
/// </remarks>
public static string[] GetClientPath(Guid[] path)
{
var rootId = CoreConstants.System.Root.ToInvariantString();
var clientPath = new[] { rootId }
.Concat(path.Select(x => GuidHelper.GetString(x)))
.ToArray();
return clientPath;
}
示例2: GetLastVersionTaskActivityDC
public static IEnumerable<TaskActivityDC> GetLastVersionTaskActivityDC(Guid[] taskGuids)
{
var result = WorkflowsQueryServiceUtility.UsingClientReturn(client => client.TaskActivityGetList(new TaskActivityGetListRequest()
{
List = taskGuids.Select(t => new TaskActivityDC() { Guid = t }).ToList(),
}.SetIncaller()));
result.StatusReply.CheckErrors();
return result.List;
}
示例3: CreateFilter
/// <summary>
/// Creates a filter from the given properties.
/// </summary>
/// <param name="subscriptionIds">The subscriptions to query.</param>
/// <param name="resourceGroup">The name of the resource group/</param>
/// <param name="resourceType">The resource type.</param>
/// <param name="resourceName">The resource name.</param>
/// <param name="tagName">The tag name.</param>
/// <param name="tagValue">The tag value.</param>
/// <param name="filter">The filter.</param>
public static string CreateFilter(
Guid[] subscriptionIds,
string resourceGroup,
string resourceType,
string resourceName,
string tagName,
string tagValue,
string filter,
string nameContains = null,
string resourceGroupNameContains = null)
{
var filterStringBuilder = new StringBuilder();
if (subscriptionIds.CoalesceEnumerable().Any())
{
if (subscriptionIds.Length > 1)
{
filterStringBuilder.Append("(");
}
filterStringBuilder.Append(subscriptionIds
.Select(subscriptionId => string.Format("subscriptionId EQ '{0}'", subscriptionId))
.ConcatStrings(" OR "));
if (subscriptionIds.Length > 1)
{
filterStringBuilder.Append(")");
}
}
if (!string.IsNullOrWhiteSpace(resourceGroup))
{
if (filterStringBuilder.Length > 0)
{
filterStringBuilder.Append(" AND ");
}
filterStringBuilder.AppendFormat("resourceGroup EQ '{0}'", resourceGroup);
}
var remainderFilter = QueryFilterBuilder.CreateFilter(resourceType, resourceName, tagName, tagValue, filter, nameContains, resourceGroupNameContains);
if (filterStringBuilder.Length > 0 && !string.IsNullOrWhiteSpace(remainderFilter))
{
return filterStringBuilder.ToString() + " AND " + remainderFilter;
}
return filterStringBuilder.Length > 0
? filterStringBuilder.ToString()
: remainderFilter;
}
示例4: DeleteArticles
/// <summary>
/// Deletes multiples articles
/// </summary>
/// <param name="articlesIds">Array of articles' ids</param>
public void DeleteArticles(Guid[] articlesIds)
{
// Converti le tableau de Guid en tableau de string.
string[] strIds = articlesIds.Select(id => id.ToString()).ToArray();
using (var conn = OpenConnection())
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "dbo.pDeleteArticlesFromIds";
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.AddParameterWithValue("articlesids_in",
//NpgsqlTypes.NpgsqlDbType.Array | NpgsqlTypes.NpgsqlDbType.Varchar,
strIds);
cmd.ExecuteNonQuery();
}
}
示例5: Add
public void Add(ReservedIdsSource id, Guid[] ids)
{
_db.HandleTransientErrors(db =>
{
try
{
db.Insert(new ReservedIdRow()
{
Id = ReservedIdRow.GetId(id),
Data = ids.Select(d => d.ToString()).StringJoin()
});
}
catch (DbException ex) when (db.IsUniqueViolation(ex))
{
//ignore duplicates
}
});
}
示例6: Delete
public static void Delete(Guid[] ids)
{
using (var session = Workflow.WorkflowInit.Provider.Store.OpenSession())
{
var objs = session.Load<Document>(ids.Select(c=>c as ValueType).ToList());
foreach (Document item in objs)
{
session.Delete(item);
}
session.SaveChanges();
}
WorkflowInbox[] wis = null;
do
{
foreach (var id in ids)
{
using (var session = Workflow.WorkflowInit.Provider.Store.OpenSession())
{
wis = session.Query<WorkflowInbox>().Where(c => c.ProcessId == id).ToArray();
foreach (var wi in wis)
session.Delete<WorkflowInbox>(wi);
session.SaveChanges();
}
}
} while (wis.Length > 0);
}
示例7: Run
public IObservable<PerfTestResult> Run(Guid[] tests, int start, int step, int end, PerfTestConfiguration configuration, bool parallel = false)
{
return TestSuiteManager.Run(tests.Select(x => this.Tests[x]).ToArray(), start, step, end, configuration, parallel);
}
示例8: ReorderPhotos
public Status<string[]> ReorderPhotos(string username, Guid[] photoIds)
{
if (photoIds.Length == 0)
return Status.ValidationError<string[]>(null, "photoIds", "photoIds cannot be empty");
string[] existingPhotoIds = null;
Guid primaryPhotoId = photoIds[0];
using (RentlerContext context = new RentlerContext())
{
try
{
var building = (from p in context.Photos
.Include("Building.Photos")
where p.PhotoId == primaryPhotoId &&
p.Building.User.Username == username
select p.Building).SingleOrDefault();
if (building == null)
return Status.NotFound<string[]>();
// save order prior to changing in case we have to restore them
var photos = from p in building.Photos
orderby p.SortOrder
select p;
existingPhotoIds = photos.Select(p => p.PhotoId.ToString()).ToArray();
for (int i = 0; i < photoIds.Length; ++i)
{
var photo = photos.SingleOrDefault(p => p.PhotoId == photoIds[i]);
photo.SortOrder = i;
// primary photo
if (i == 0)
{
building.PrimaryPhotoId = photo.PhotoId;
building.PrimaryPhotoExtension = photo.Extension;
}
}
context.SaveChanges();
string[] resultIds = photoIds.Select(i => i.ToString()).ToArray();
InvalidateCache(building.BuildingId);
return Status.OK<string[]>(resultIds);
}
catch (Exception ex)
{
return Status.Error<string[]>(ex.Message, existingPhotoIds);
}
}
}
示例9: BeginPublish
private Guid[] BeginPublish(Guid[] webresourceIds)
{
UpdateStatus("Publishing...");
OrganizationRequest request = new OrganizationRequest { RequestName = "PublishXml" };
request.Parameters = new ParameterCollection();
request.Parameters.Add(
new KeyValuePair<string, object>("ParameterXml",
string.Format("<importexportxml><webresources>{0}</webresources></importexportxml>",
string.Join("", webresourceIds.Select(a => string.Format("<webresource>{0}</webresource>", a)))
)));
this.Sdk.Execute(request);
return webresourceIds;
}
示例10: StartScanningForDevices
public async void StartScanningForDevices(Guid[] serviceUuids)
{
if (_isScanning)
{
Mvx.Trace("Adapter: Already scanning!");
return;
}
_isScanning = true;
// in ScanTimeout seconds, stop the scan
_cancellationTokenSource = new CancellationTokenSource();
try
{
// Wait for the PoweredOn state
await WaitForState(CBCentralManagerState.PoweredOn, _cancellationTokenSource.Token).ConfigureAwait(false);
Mvx.Trace("Adapter: Starting a scan for devices.");
CBUUID[] serviceCbuuids = null;
if (serviceUuids != null && serviceUuids.Any())
{
serviceCbuuids = serviceUuids.Select(u => CBUUID.FromString(u.ToString())).ToArray();
Mvx.Trace("Adapter: Scanning for " + serviceCbuuids.First());
}
// clear out the list
_discoveredDevices = new List<IDevice>();
// start scanning
_central.ScanForPeripherals(serviceCbuuids);
await Task.Delay(ScanTimeout, _cancellationTokenSource.Token);
Mvx.Trace("Adapter: Scan timeout has elapsed.");
StopScan();
TryDisposeToken();
_isScanning = false;
//important for this to be caled after _isScanning = false so don't move to finally block
ScanTimeoutElapsed(this, new EventArgs());
}
catch (TaskCanceledException)
{
Mvx.Trace("Adapter: Scan was cancelled.");
StopScan();
TryDisposeToken();
_isScanning = false;
}
}
示例11: StartLeScan
private async void StartLeScan(Guid[] serviceUuids)
{
if (_isScanning)
{
Mvx.Trace("Adapter: Already scanning.");
return;
}
_isScanning = true;
// clear out the list
_discoveredDevices = new List<IDevice>();
if (serviceUuids == null || !serviceUuids.Any())
{
if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop)
{
Mvx.Trace("Adapter < 21: Starting a scan for devices.");
//without filter
_adapter.StartLeScan(this);
}
else
{
Mvx.Trace("Adapter >= 21: Starting a scan for devices.");
if (_adapter.BluetoothLeScanner != null)
{
_adapter.BluetoothLeScanner.StartScan(_api21ScanCallback);
}
else
{
Mvx.Trace("Adapter >= 21: Scan failed. Bluetooth is probably off");
}
}
}
else
{
if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop)
{
var uuids = serviceUuids.Select(u => UUID.FromString(u.ToString())).ToArray();
Mvx.Trace("Adapter < 21: Starting a scan for devices.");
_adapter.StartLeScan(uuids, this);
}
else
{
Mvx.Trace("Adapter >=21: Starting a scan for devices with service ID {0}.", serviceUuids.First());
var scanFilters = new List<ScanFilter>();
foreach (var serviceUuid in serviceUuids)
{
var sfb = new ScanFilter.Builder();
sfb.SetServiceUuid(ParcelUuid.FromString(serviceUuid.ToString()));
scanFilters.Add(sfb.Build());
}
var ssb = new ScanSettings.Builder();
//ssb.SetCallbackType(ScanCallbackType.AllMatches);
if (_adapter.BluetoothLeScanner != null)
{
_adapter.BluetoothLeScanner.StartScan(scanFilters, ssb.Build(), _api21ScanCallback);
}
else
{
Mvx.Trace("Adapter >= 21: Scan failed. Bluetooth is probably off");
}
}
}
// in ScanTimeout seconds, stop the scan
_cancellationTokenSource = new CancellationTokenSource();
try
{
await Task.Delay(ScanTimeout, _cancellationTokenSource.Token);
Mvx.Trace("Adapter: Scan timeout has elapsed.");
StopScan();
TryDisposeToken();
_isScanning = false;
//important for this to be caled after _isScanning = false;
ScanTimeoutElapsed(this, new EventArgs());
}
catch (TaskCanceledException)
{
Mvx.Trace("Adapter: Scan was cancelled.");
StopScan();
TryDisposeToken();
_isScanning = false;
}
}
示例12: GetSystemConnectedOrPairedDevices
public override List<IDevice> GetSystemConnectedOrPairedDevices(Guid[] services = null)
{
CBUUID[] serviceUuids = null;
if (services != null)
{
serviceUuids = services.Select(guid => CBUUID.FromString(guid.ToString())).ToArray();
}
var nativeDevices = _centralManager.RetrieveConnectedPeripherals(serviceUuids);
return nativeDevices.Select(d => new Device(this, d)).Cast<IDevice>().ToList();
}
示例13: AddWorkspaceCheckoutId
public void AddWorkspaceCheckoutId(Guid[] workspaceCheckoutId)
{
if (workspaceCheckoutId == null || workspaceCheckoutId.Length == 0)
{
return;
}
var strings = workspaceCheckoutId.Select(g => g.ToString()).ToArray();
Contract.Assume(strings.Length > 0);
AddFilterPart("workspacecheckoutid", strings);
}
示例14: GetMailAddress
public virtual MailAddress[] GetMailAddress(Guid[] userIds)
{
return userIds.Select(x => GetMailAddress(x)).ToArray();
}
示例15: ListRawDataForCharacteristics
/// <summary>
/// Fetches a list of raw data information for the characteristic identified by <paramref name="charateristicUuids"/>.
/// </summary>
/// <param name="charateristicUuids">The list of characteristic uuids the raw data information should be fetched for.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
public Task<RawDataInformation[]> ListRawDataForCharacteristics( Guid[] charateristicUuids, CancellationToken cancellationToken = default( CancellationToken ) )
{
return ListRawData( RawDataEntity.Characteristic, charateristicUuids.Select( u => u.ToString() ).ToArray(), cancellationToken );
}