public static TypeSpecifier GetCoroutineReturnType(IEnumerable <BaseType> types) { return(new("Ref", false, false, false, new[] { GenericsHelper.BuildAggregateType(types) })); }
private static MethodInfo GetSyncAllTablesMethod() { #pragma warning disable 4014 //we extracting the method definitions by reflection, not executing the method itself return(GenericsHelper.GetMethod <ItemManagerWrapper>(x => x.SyncTableAsync <BaseModel>())); #pragma warning restore 4014 }
public static IWriteCommand CreateCommand(EntityEntry entityEntry) { var entityType = entityEntry.EntityType; var method = GenericsHelper.GetMethodDelegate <Func <EntityEntry, IWriteCommand> >( typeof(EntityCommandBuilder), nameof(InternalCreateCommand), entityType ); return(method(entityEntry)); }
public string GenericHelper() { var method = GenericsHelper.GetMethodDelegate <Func <Type, string, string> >( typeof(GenericMethodInvokeBenchmark), nameof(MyGenericMethod), typeof(int) ); return(method(typeof(int), "1")); }
public EvaluationDetailsViewModel(List <MatchDto> matchlist, IList <FootballScoreViewModel> scorelist, List <FootballScoreViewModel> predictionlist, List <string> tempResultlist) { Matchlist = matchlist ?? new List <MatchDto>(); Scorelist = scorelist ?? new List <FootballScoreViewModel>(); Predictionlist = predictionlist ?? new List <FootballScoreViewModel>(); TempResultlist = tempResultlist ?? new List <string>(); if (!GenericsHelper.IsNullOrEmpty(tempResultlist) && !tempResultlist.Contains("-")) { Sum = tempResultlist.Select(tr => Convert.ToInt32(tr)).Sum(); } }
public virtual void SaveChanges() { ChangeTracker.DetectChanges(); AfterDetectChanges(); var commands = GenerateWriteCommands(); var writeModelOptions = GetWriteModelOptions(); var commandsByEntityType = commands.GroupBy(c => c.EntityType); foreach (var entityTypeCommands in commandsByEntityType) { var method = GenericsHelper.GetMethodDelegate <Action <IMongoDbConnection, IEnumerable <IWriteCommand>, WriteModelOptions> >( typeof(MongoDbContext), nameof(InternalSaveChanges), entityTypeCommands.Key ); method(Connection, entityTypeCommands, writeModelOptions); } ChangeTracker.CommitChanges(); CommandStaging.CommitChanges(); }
public virtual async Task SaveChangesAsync(CancellationToken cancellationToken = default) { ChangeTracker.DetectChanges(); AfterDetectChanges(); var commands = GenerateWriteCommands(); var writeModelOptions = GetWriteModelOptions(); var commandsByEntityType = commands.GroupBy(c => c.EntityType); foreach (var entityTypeCommands in commandsByEntityType) { var methodAsync = GenericsHelper.GetMethodDelegate <Func <IMongoDbConnection, IEnumerable <IWriteCommand>, WriteModelOptions, CancellationToken, Task> >( typeof(MongoDbContext), nameof(InternalSaveChangesAsync), entityTypeCommands.Key ); await methodAsync(Connection, entityTypeCommands, writeModelOptions, cancellationToken); } ChangeTracker.CommitChanges(); CommandStaging.CommitChanges(); }
public static bool CanBeCastTo(this Type pluggedType, Type pluginType) { if (pluggedType == null) { return(false); } if (pluggedType.IsInterface || pluggedType.IsAbstract) { return(false); } if (pluginType.IsOpenGeneric()) { return(GenericsHelper.CanBeCast(pluginType, pluggedType)); } if (IsOpenGeneric(pluggedType)) { return(false); } return(pluginType.IsAssignableFrom(pluggedType)); }
public static EncodingInfo EncodingInfo([NotNull] this Encoding thisValue) { return(GenericsHelper.CreateInstance <EncodingInfo>(thisValue.CodePage, thisValue.WebName, thisValue.EncodingName)); }
public TypeSpecifier GetResultantType() { return(GenericsHelper.DetermineTypeNodeType(TypeReturnNode)); }
public Gene Clone() { return(GenericsHelper.DeepClone(this)); }