text
stringlengths
9
39.2M
dir
stringlengths
25
226
lang
stringclasses
163 values
created_date
timestamp[s]
updated_date
timestamp[s]
repo_name
stringclasses
751 values
repo_full_name
stringclasses
752 values
star
int64
1.01k
183k
len_tokens
int64
1
18.5M
```smalltalk using System; using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CodeFirst.DataAccess.Configurations; public class ClientsConfiguration : IEntityTypeConfiguration<Clients> { public void Configure(EntityTypeBuilder<Clients> builder) { builder.HasKey(e => e.ClientId) .HasName("client_pkey"); builder.Property(e => e.ClientId) .HasColumnName("client_id"); builder.Property(e => e.Firstname) .HasColumnName("first_name"); builder.Property(e => e.Lastname) .HasColumnName("last_name"); builder.Property(e => e.Birthday) .HasColumnName("birthday"); builder.ToTable("clients"); builder.HasData( new Clients(1, "Hank", "Hill", Convert.ToDateTime("1954-04-19")), new Clients(2, "Brian", "Griffin", Convert.ToDateTime("2011-09-11")), new Clients(3, "Gary", "Goodspeed", Convert.ToDateTime("1989-03-12")), new Clients(4, "Bob", "Belcher", Convert.ToDateTime("1977-01-23")), new Clients(5, "Lisa", "Simpson", Convert.ToDateTime("2012-05-09")), new Clients(6, "Rick", "Sanchez", Convert.ToDateTime("1965-03-17"))); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Configurations/ClientsConfiguration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
289
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CodeFirst.DataAccess.Configurations; public class CopiesConfiguration : IEntityTypeConfiguration<Copies> { public void Configure(EntityTypeBuilder<Copies> builder) { builder.HasKey(e => e.CopyId) .HasName("copies_pkey"); builder.Property(e => e.MovieId) .IsRequired() .HasColumnName("movie_id"); builder.Property(e => e.CopyId) .HasColumnName("copy_id"); builder.Property(e => e.Available) .HasColumnName("available"); builder.ToTable("copies"); builder.HasData(new Copies(1, 1, true), new Copies(2, 1, false), new Copies(3, 2, true), new Copies(4, 3, true), new Copies(5, 3, false), new Copies(6, 3, true), new Copies(7, 4, true), new Copies(8, 5, false), new Copies(9, 6, true), new Copies(10, 6, false), new Copies(11, 6, true), new Copies(12, 7, true), new Copies(13, 7, true), new Copies(14, 8, false), new Copies(15, 9, true), new Copies(16, 10, true), new Copies(17, 10, false), new Copies(18, 10, true), new Copies(19, 10, true), new Copies(20, 10, true)); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Configurations/CopiesConfiguration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
352
```xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net8.0</TargetFramework> </PropertyGroup> <ItemGroup> <Compile Include="..\CodeFirst.ConsoleApp\Program.cs" Link="Program.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj" /> <ProjectReference Include="..\CodeFirst.DataAccess\CodeFirst.DataAccess.csproj" /> </ItemGroup> </Project> ```
/content/code_sandbox/src-examples/CodeFirst.ConsoleApp8/CodeFirst.ConsoleApp8.csproj
xml
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
137
```xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>net6.0;net8.0</TargetFrameworks> </PropertyGroup> <ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' "> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.28" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.28" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.28"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.22" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.28"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> </ItemGroup> <ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' "> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.3" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> </ItemGroup> </Project> ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/CodeFirst.DataAccess.csproj
xml
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
434
```yaml coverage: range: 10..100 round: down precision: 2 ```
/content/code_sandbox/codecov.yml
yaml
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
21
```unknown <wpf:ResourceDictionary xml:space="preserve" xmlns:x="path_to_url" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="path_to_url"> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EF/@EntryIndexedValue">EF</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IL/@EntryIndexedValue">IL</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UTC/@EntryIndexedValue">UTC</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WASM/@EntryIndexedValue">WASM</s:String> <s:Boolean x:Key="/Default/UserDictionary/Words/=DLL_0027s/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Formattable/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=ilgenerator/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=renamer/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Sqlite/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Unescape/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Xunit/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> ```
/content/code_sandbox/System.Linq.Dynamic.Core.sln.DotSettings
unknown
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
373
```batchfile rem path_to_url SET version=v1.4.5 GitHubReleaseNotes --output CHANGELOG.md --exclude-labels invalid question documentation wontfix environment --language en --version %version% --token %GH_TOKEN% ```
/content/code_sandbox/Generate-ReleaseNotes.bat
batchfile
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
47
```smalltalk using System; using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CodeFirst.DataAccess.Configurations; public class ActorsConfiguration : IEntityTypeConfiguration<Actors> { public void Configure(EntityTypeBuilder<Actors> builder) { builder.HasKey(e => e.ActorId) .HasName("actor_pkey"); builder.Property(e => e.ActorId) .HasColumnName("actor_id"); builder.Property(e => e.Firstname) .HasColumnName("first_name"); builder.Property(e => e.Lastname) .HasColumnName("last_name"); builder.Property(e => e.Birthday) .HasColumnName("birthday"); builder.ToTable("actors"); builder.HasData( new Actors(1, "Arnold", "Schwarzenegger", Convert.ToDateTime("1947-07-30")), new Actors(2, "Anthony", "Daniels", Convert.ToDateTime("1946-02-21")), new Actors(3, "Harrison", "Ford", Convert.ToDateTime("1942-07-13")), new Actors(4, "Carrie", "Fisher", Convert.ToDateTime("1956-10-21")), new Actors(5, "Alec", "Guiness", Convert.ToDateTime("1914-04-02")), new Actors(6, "Peter", "Cushing", Convert.ToDateTime("1913-05-26")), new Actors(7, "David", "Prowse", Convert.ToDateTime("1944-05-19")), new Actors(8, "Peter", "Mayhew", Convert.ToDateTime("1935-07-01")), new Actors(9, "Michael", "Biehn", Convert.ToDateTime("1956-07-31")), new Actors(10, "Linda", "Hamilton", Convert.ToDateTime("1956-09-26")), new Actors(11, "Bill", "Murray", Convert.ToDateTime("1950-09-21")), new Actors(12, "Dan", "Aykroyd", Convert.ToDateTime("1952-07-01")), new Actors(13, "Sigourney", "Weaver", Convert.ToDateTime("1949-10-08")), new Actors(14, "Robert", "De Niro", Convert.ToDateTime("1943-08-17")), new Actors(15, "Jodie", "Foster", Convert.ToDateTime("1962-11-19")), new Actors(16, "Harvey", "Keitel", Convert.ToDateTime("1939-05-13")), new Actors(17, "Cybill", "Shepherd", Convert.ToDateTime("1950-02-18")), new Actors(18, "Tom", "Berenger", Convert.ToDateTime("1949-05-31")), new Actors(19, "Willem", "Dafoe", Convert.ToDateTime("1955-07-22")), new Actors(20, "Charlie", "Sheen", Convert.ToDateTime("1965-09-03")), new Actors(21, "Harrison", "Ford", Convert.ToDateTime("1942-07-13")), new Actors(22, "Emmanuelle", "Seigner", Convert.ToDateTime("1966-06-22")), new Actors(23, "Jean", "Reno", Convert.ToDateTime("1948-07-30")), new Actors(24, "Billy", "Crystal", Convert.ToDateTime("1948-03-14")), new Actors(25, "Lisa", "Kudrow", Convert.ToDateTime("1963-07-30")), new Actors(26, "Gary", "Oldman", Convert.ToDateTime("1958-03-21")), new Actors(27, "Natalie", "Portman", Convert.ToDateTime("1981-06-09")), new Actors(28, "Tom", "Cruise", Convert.ToDateTime("1962-07-03"))); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Configurations/ActorsConfiguration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
816
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CodeFirst.DataAccess.Configurations; public class StarringConfiguration : IEntityTypeConfiguration<Starring> { public void Configure(EntityTypeBuilder<Starring> builder) { builder.HasKey(e => new {e.ActorId, e.MovieId}); // configure many to many: movies - actors builder.HasOne(e => e.Movie) .WithMany(e => e.Starring) .OnDelete(DeleteBehavior.Cascade) .HasForeignKey(e => e.MovieId); builder.HasOne(e => e.Actor) .WithMany(e => e.Starring) .OnDelete(DeleteBehavior.Cascade) .HasForeignKey(e => e.ActorId); builder.Property(e => e.MovieId) .IsRequired() .HasColumnName("movie_id"); builder.Property(e => e.ActorId) .IsRequired() .HasColumnName("actor_id"); builder.ToTable("starring"); builder.HasData(new Starring(2, 1), new Starring(3, 1), new Starring(4, 1), new Starring(5, 1), new Starring(6, 1), new Starring(7, 1), new Starring(8, 1), new Starring(1, 3), new Starring(9, 3), new Starring(10, 3), new Starring(11, 2), new Starring(12, 2), new Starring(13, 2), new Starring(14, 4), new Starring(15, 4), new Starring(16, 4), new Starring(17, 4), new Starring(18, 5), new Starring(19, 5), new Starring(20, 5), new Starring(21, 6), new Starring(22, 6), new Starring(14, 7), new Starring(23, 7), new Starring(14, 8), new Starring(24, 8), new Starring(25, 8), new Starring(23, 9), new Starring(27, 9), new Starring(23, 10), new Starring(28, 10)); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Configurations/StarringConfiguration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
515
```smalltalk namespace CodeFirst.DataAccess.Models; public class Employees { public int EmployeeId { get; set; } public string Firstname { get; set; } public string Lastname { get; set; } public float? Salary { get; set; } // yeah, salary might be nullable, why not :) public string City { get; set; } public Employees() { } public Employees(int employeeId, string firstname, string lastname, float? salary, string city) { EmployeeId = employeeId; Firstname = firstname; Lastname = lastname; Salary = salary; City = city; } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Models/Employees.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
140
```smalltalk using System.Collections.Generic; namespace CodeFirst.DataAccess.Models; public class Copies { public int CopyId { get; set; } public bool Available { get; set; } public int MovieId { get; set; } // navigational properties // one copy has only one movie public virtual Movies Movie { get; set; } // to maintain many to many copies - rentals public virtual ICollection<Rentals> Rentals { get; set; } public Copies() { } public Copies(int copyId, int movieId, bool available) { CopyId = copyId; MovieId = movieId; Available = available; } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Models/Copies.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
147
```smalltalk using System.Collections.Generic; namespace CodeFirst.DataAccess.Models; public class Movies { public int MovieId { get; set; } public string Title { get; set; } public int Year { get; set; } public int AgeRestriction { get; set; } public float Price { get; set; } public Movies() { } public Movies(int movieId, string title, int year, int ageRestriction, float price) { MovieId = movieId; Title = title; Year = year; AgeRestriction = ageRestriction; Price = price; } // navigational properties // one movie may have many copies public virtual ICollection<Copies> Copies { get; set; } // this is composite key to get many to many movies - actors public virtual ICollection<Starring> Starring { get; set; } public override string ToString() { return $"{MovieId}, {Title}, {Year}, {Price}"; } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Models/Movies.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
220
```smalltalk using System; using System.Collections.Generic; namespace CodeFirst.DataAccess.Models; public class Actors { public int ActorId { get; set; } public string Firstname { get; set; } public string Lastname { get; set; } public DateTime? Birthday { get; set; } public Actors() { } public Actors(int actorId, string firstname, string lastname, DateTime? birthday) { ActorId = actorId; Firstname = firstname; Lastname = lastname; Birthday = birthday; } // navigational properties // this is composite key to get many to many movies - actors public virtual ICollection<Starring> Starring { get; set; } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Models/Actors.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
155
```smalltalk using System; using System.Collections.Generic; namespace CodeFirst.DataAccess.Models; public class Clients { public int ClientId { get; set; } public string Firstname { get; set; } public string Lastname { get; set; } public DateTime? Birthday { get; set; } // navigational properties public virtual ICollection<Rentals> Rentals { get; set; } public Clients() { } public Clients(int clientId, string firstname, string lastname, DateTime? birthday) { ClientId = clientId; Firstname = firstname; Lastname = lastname; Birthday = birthday; } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Models/Clients.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
138
```smalltalk namespace CodeFirst.DataAccess.Models; public class Starring { public int ActorId { get; set; } public int MovieId { get; set; } // navigational properties public virtual Movies Movie { get; set; } public virtual Actors Actor { get; set; } public Starring() { } public Starring(int actorId, int movieId) { ActorId = actorId; MovieId = movieId; } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Models/Starring.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
104
```smalltalk using System; namespace CodeFirst.DataAccess.Models; public class Rentals { public int CopyId { get; set; } public int ClientId { get; set; } public DateTime? DateOfRental { get; set; } public DateTime? DateOfReturn { get; set; } // navigational properties public virtual Clients Client { get; set; } public virtual Copies Copy { get; set; } public Rentals() { } public Rentals(int clientId, int copyId, DateTime? dateOfRental, DateTime? dateOfReturn) { CopyId = copyId; ClientId = clientId; DateOfRental = dateOfRental; DateOfReturn = dateOfReturn; } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Models/Rentals.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
161
```smalltalk using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; using CodeFirst.DataAccess.Interfaces; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Repositories; public abstract class BaseRepository<T> : IRepository<T> where T : class { private readonly DbContext _baseContext; private readonly DbSet<T> _dbSet; protected BaseRepository(DbContext baseContext) { _baseContext = baseContext; _dbSet = _baseContext.Set<T>(); } public async Task AddAsync(T entity) { await _dbSet.AddAsync(entity); } public void Update(T entity) { _dbSet.Attach(entity); _baseContext.Entry(entity).State = EntityState.Modified; } public void Delete(T entity) { _dbSet.Remove(entity); } public void Delete(Expression<Func<T, bool>> where) { var objects = _dbSet.Where(where).AsEnumerable(); foreach (var obj in objects) _dbSet.Remove(obj); } public async Task<T> GetByIdAsync(int id) { return await _dbSet.FindAsync(id); } public async Task<T> GetSingleAsync(Expression<Func<T, bool>> where) { return await _dbSet.FirstOrDefaultAsync(where); } public async Task<IEnumerable<T>> GetAllAsync() { return await _dbSet.ToListAsync(); } public async Task<IEnumerable<T>> GetManyAsync(Expression<Func<T, bool>> where) { return await _dbSet.Where(where).ToListAsync(); } public async Task<bool> SaveChangesAsync() { return await _baseContext.SaveChangesAsync() > 0; } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Repositories/BaseRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
357
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Repositories; public class StarringRepository : BaseRepository<Starring> { public StarringRepository(DbContext baseContext) : base(baseContext) { } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Repositories/StarringRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
49
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Repositories; public class RentalsRepository : BaseRepository<Rentals> { public RentalsRepository(DbContext baseContext) : base(baseContext) { } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Repositories/RentalsRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
47
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Repositories; public class EmployeesRepository : BaseRepository<Employees> { public EmployeesRepository(DbContext baseContext) : base(baseContext) { } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Repositories/EmployeesRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
47
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Repositories; public class ClientsRepository : BaseRepository<Clients> { public ClientsRepository(DbContext baseContext) : base(baseContext) { } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Repositories/ClientsRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
46
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Repositories; public class MoviesRepository : BaseRepository<Movies> { public MoviesRepository(DbContext baseContext) : base(baseContext) { } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Repositories/MoviesRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
46
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Repositories; public class ActorsRepository : BaseRepository<Actors> { public ActorsRepository(DbContext baseContext) : base(baseContext) { } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Repositories/ActorsRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
47
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Repositories; public class CopiesRepository : BaseRepository<Copies> { public CopiesRepository(DbContext baseContext) : base(baseContext) { } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Repositories/CopiesRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
46
```smalltalk using CodeFirst.DataAccess.Configurations; using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Context; public class SqlServerDbContext : DbContext { public SqlServerDbContext(DbContextOptions options) : base(options) { } public DbSet<Movies> Movies { get; set; } public DbSet<Copies> Copies { get; set; } public DbSet<Starring> Starring { get; set; } public DbSet<Actors> Actors { get; set; } public DbSet<Rentals> Rentals { get; set; } public DbSet<Employees> Employees { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.ApplyConfiguration(new MoviesConfiguration()); modelBuilder.ApplyConfiguration(new CopiesConfiguration()); modelBuilder.ApplyConfiguration(new ActorsConfiguration()); modelBuilder.ApplyConfiguration(new StarringConfiguration()); modelBuilder.ApplyConfiguration(new RentalsConfiguration()); modelBuilder.ApplyConfiguration(new ClientsConfiguration()); modelBuilder.ApplyConfiguration(new EmployeesConfiguration()); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Context/SqlServerDbContext.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
205
```smalltalk using CodeFirst.DataAccess.Configurations; using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; namespace CodeFirst.DataAccess.Context; public class PostgresDbContext : DbContext { public PostgresDbContext(DbContextOptions options) : base(options) { } public DbSet<Movies> Movies { get; set; } public DbSet<Copies> Copies { get; set; } public DbSet<Starring> Starring { get; set; } public DbSet<Actors> Actors { get; set; } public DbSet<Rentals> Rentals { get; set; } public DbSet<Employees> Employees { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.ApplyConfiguration(new MoviesConfiguration()); modelBuilder.ApplyConfiguration(new CopiesConfiguration()); modelBuilder.ApplyConfiguration(new ActorsConfiguration()); modelBuilder.ApplyConfiguration(new StarringConfiguration()); modelBuilder.ApplyConfiguration(new RentalsConfiguration()); modelBuilder.ApplyConfiguration(new ClientsConfiguration()); modelBuilder.ApplyConfiguration(new EmployeesConfiguration()); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Context/PostgresDbContext.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
206
```smalltalk // <auto-generated /> using System; using CodeFirst.DataAccess.Context; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace CodeFirst.DataAccess.Migrations { [DbContext(typeof(PostgresDbContext))] [Migration("20220124205348_PostgreSqlInitialMigration")] partial class PostgreSqlInitialMigration { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .UseIdentityByDefaultColumns() .HasAnnotation("Relational:MaxIdentifierLength", 63) .HasAnnotation("ProductVersion", "5.0.1"); modelBuilder.Entity("CodeFirst.Models.Models.Actors", b => { b.Property<int>("ActorId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("actor_id") .UseIdentityByDefaultColumn(); b.Property<DateTime?>("Birthday") .HasColumnType("timestamp without time zone") .HasColumnName("birthday"); b.Property<string>("Firstname") .HasColumnType("text") .HasColumnName("first_name"); b.Property<string>("Lastname") .HasColumnType("text") .HasColumnName("last_name"); b.HasKey("ActorId") .HasName("actor_pkey"); b.ToTable("actors"); b.HasData( new { ActorId = 1, Birthday = new DateTime(1947, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Arnold", Lastname = "Schwarzenegger" }, new { ActorId = 2, Birthday = new DateTime(1946, 2, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Anthony", Lastname = "Daniels" }, new { ActorId = 3, Birthday = new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harrison", Lastname = "Ford" }, new { ActorId = 4, Birthday = new DateTime(1956, 10, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Carrie", Lastname = "Fisher" }, new { ActorId = 5, Birthday = new DateTime(1914, 4, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Alec", Lastname = "Guiness" }, new { ActorId = 6, Birthday = new DateTime(1913, 5, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Peter", Lastname = "Cushing" }, new { ActorId = 7, Birthday = new DateTime(1944, 5, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "David", Lastname = "Prowse" }, new { ActorId = 8, Birthday = new DateTime(1935, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Peter", Lastname = "Mayhew" }, new { ActorId = 9, Birthday = new DateTime(1956, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Michael", Lastname = "Biehn" }, new { ActorId = 10, Birthday = new DateTime(1956, 9, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Linda", Lastname = "Hamilton" }, new { ActorId = 11, Birthday = new DateTime(1950, 9, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Bill", Lastname = "Murray" }, new { ActorId = 12, Birthday = new DateTime(1952, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Dan", Lastname = "Aykroyd" }, new { ActorId = 13, Birthday = new DateTime(1949, 10, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Sigourney", Lastname = "Weaver" }, new { ActorId = 14, Birthday = new DateTime(1943, 8, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Robert", Lastname = "De Niro" }, new { ActorId = 15, Birthday = new DateTime(1962, 11, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Jodie", Lastname = "Foster" }, new { ActorId = 16, Birthday = new DateTime(1939, 5, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harvey", Lastname = "Keitel" }, new { ActorId = 17, Birthday = new DateTime(1950, 2, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Cybill", Lastname = "Shepherd" }, new { ActorId = 18, Birthday = new DateTime(1949, 5, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Tom", Lastname = "Berenger" }, new { ActorId = 19, Birthday = new DateTime(1955, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Willem", Lastname = "Dafoe" }, new { ActorId = 20, Birthday = new DateTime(1965, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Charlie", Lastname = "Sheen" }, new { ActorId = 21, Birthday = new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harrison", Lastname = "Ford" }, new { ActorId = 22, Birthday = new DateTime(1966, 6, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Emmanuelle", Lastname = "Seigner" }, new { ActorId = 23, Birthday = new DateTime(1948, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Jean", Lastname = "Reno" }, new { ActorId = 24, Birthday = new DateTime(1948, 3, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Billy", Lastname = "Crystal" }, new { ActorId = 25, Birthday = new DateTime(1963, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Lisa", Lastname = "Kudrow" }, new { ActorId = 26, Birthday = new DateTime(1958, 3, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Gary", Lastname = "Oldman" }, new { ActorId = 27, Birthday = new DateTime(1981, 6, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Natalie", Lastname = "Portman" }, new { ActorId = 28, Birthday = new DateTime(1962, 7, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Tom", Lastname = "Cruise" }); }); modelBuilder.Entity("CodeFirst.Models.Models.Clients", b => { b.Property<int>("ClientId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("client_id") .UseIdentityByDefaultColumn(); b.Property<DateTime?>("Birthday") .HasColumnType("timestamp without time zone") .HasColumnName("birthday"); b.Property<string>("Firstname") .HasColumnType("text") .HasColumnName("first_name"); b.Property<string>("Lastname") .HasColumnType("text") .HasColumnName("last_name"); b.HasKey("ClientId") .HasName("client_pkey"); b.ToTable("clients"); b.HasData( new { ClientId = 1, Birthday = new DateTime(1954, 4, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Hank", Lastname = "Hill" }, new { ClientId = 2, Birthday = new DateTime(2011, 9, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Brian", Lastname = "Griffin" }, new { ClientId = 3, Birthday = new DateTime(1989, 3, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Gary", Lastname = "Goodspeed" }, new { ClientId = 4, Birthday = new DateTime(1977, 1, 23, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Bob", Lastname = "Belcher" }, new { ClientId = 5, Birthday = new DateTime(2012, 5, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Lisa", Lastname = "Simpson" }, new { ClientId = 6, Birthday = new DateTime(1965, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Rick", Lastname = "Sanchez" }); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.Property<int>("CopyId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("copy_id") .UseIdentityByDefaultColumn(); b.Property<bool>("Available") .HasColumnType("boolean") .HasColumnName("available"); b.Property<int>("MovieId") .HasColumnType("integer") .HasColumnName("movie_id"); b.HasKey("CopyId") .HasName("copies_pkey"); b.HasIndex("MovieId"); b.ToTable("copies"); b.HasData( new { CopyId = 1, Available = true, MovieId = 1 }, new { CopyId = 2, Available = false, MovieId = 1 }, new { CopyId = 3, Available = true, MovieId = 2 }, new { CopyId = 4, Available = true, MovieId = 3 }, new { CopyId = 5, Available = false, MovieId = 3 }, new { CopyId = 6, Available = true, MovieId = 3 }, new { CopyId = 7, Available = true, MovieId = 4 }, new { CopyId = 8, Available = false, MovieId = 5 }, new { CopyId = 9, Available = true, MovieId = 6 }, new { CopyId = 10, Available = false, MovieId = 6 }, new { CopyId = 11, Available = true, MovieId = 6 }, new { CopyId = 12, Available = true, MovieId = 7 }, new { CopyId = 13, Available = true, MovieId = 7 }, new { CopyId = 14, Available = false, MovieId = 8 }, new { CopyId = 15, Available = true, MovieId = 9 }, new { CopyId = 16, Available = true, MovieId = 10 }, new { CopyId = 17, Available = false, MovieId = 10 }, new { CopyId = 18, Available = true, MovieId = 10 }, new { CopyId = 19, Available = true, MovieId = 10 }, new { CopyId = 20, Available = true, MovieId = 10 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Employees", b => { b.Property<int>("EmployeeId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("employee_id") .UseIdentityByDefaultColumn(); b.Property<string>("City") .HasColumnType("text"); b.Property<string>("Firstname") .IsRequired() .HasColumnType("text") .HasColumnName("first_name"); b.Property<string>("Lastname") .IsRequired() .HasColumnType("text") .HasColumnName("last_name"); b.Property<float?>("Salary") .HasColumnType("real") .HasColumnName("salary"); b.HasKey("EmployeeId") .HasName("employee_id"); b.ToTable("employees"); b.HasData( new { EmployeeId = 1, City = "New York", Firstname = "John", Lastname = "Smith", Salary = 150f }, new { EmployeeId = 2, City = "New York", Firstname = "Ben", Lastname = "Johnson", Salary = 250f }, new { EmployeeId = 3, City = "New Orleans", Firstname = "Louis", Lastname = "Armstrong", Salary = 75f }, new { EmployeeId = 4, City = "London", Firstname = "John", Lastname = "Lennon", Salary = 300f }, new { EmployeeId = 5, City = "London", Firstname = "Peter", Lastname = "Gabriel", Salary = 150f }); }); modelBuilder.Entity("CodeFirst.Models.Models.Movies", b => { b.Property<int>("MovieId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("movie_id") .UseIdentityByDefaultColumn(); b.Property<int>("AgeRestriction") .HasColumnType("integer") .HasColumnName("age_restriction"); b.Property<float>("Price") .HasColumnType("real") .HasColumnName("price"); b.Property<string>("Title") .HasColumnType("text") .HasColumnName("title"); b.Property<int>("Year") .HasColumnType("integer") .HasColumnName("year"); b.HasKey("MovieId") .HasName("movies_pkey"); b.ToTable("movies"); b.HasData( new { MovieId = 1, AgeRestriction = 12, Price = 10f, Title = "Star Wars Episode IV: A New Hope", Year = 1979 }, new { MovieId = 2, AgeRestriction = 12, Price = 5.5f, Title = "Ghostbusters", Year = 1984 }, new { MovieId = 3, AgeRestriction = 15, Price = 8.5f, Title = "Terminator", Year = 1984 }, new { MovieId = 4, AgeRestriction = 17, Price = 5f, Title = "Taxi Driver", Year = 1976 }, new { MovieId = 5, AgeRestriction = 18, Price = 5f, Title = "Platoon", Year = 1986 }, new { MovieId = 6, AgeRestriction = 15, Price = 8.5f, Title = "Frantic", Year = 1988 }, new { MovieId = 7, AgeRestriction = 13, Price = 9.5f, Title = "Ronin", Year = 1998 }, new { MovieId = 8, AgeRestriction = 16, Price = 10.5f, Title = "Analyze This", Year = 1999 }, new { MovieId = 9, AgeRestriction = 16, Price = 8.5f, Title = "Leon: the Professional", Year = 1994 }, new { MovieId = 10, AgeRestriction = 13, Price = 8.5f, Title = "Mission Impossible", Year = 1996 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Rentals", b => { b.Property<int>("ClientId") .HasColumnType("integer") .HasColumnName("client_id"); b.Property<int>("CopyId") .HasColumnType("integer") .HasColumnName("copy_id"); b.Property<DateTime?>("DateOfRental") .HasColumnType("timestamp without time zone") .HasColumnName("date_of_rental"); b.Property<DateTime?>("DateOfReturn") .HasColumnType("timestamp without time zone") .HasColumnName("date_of_return"); b.HasKey("ClientId", "CopyId") .HasName("rentals_pkey"); b.HasIndex("CopyId"); b.ToTable("rentals"); b.HasData( new { ClientId = 1, CopyId = 1, DateOfRental = new DateTime(2005, 7, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 1, CopyId = 6, DateOfRental = new DateTime(2005, 7, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 3, DateOfRental = new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 5, DateOfRental = new DateTime(2005, 7, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 27, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 7, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 12, DateOfRental = new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 20, DateOfRental = new DateTime(2005, 7, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 3, DateOfRental = new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 23, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 7, DateOfRental = new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 4, CopyId = 13, DateOfRental = new DateTime(2005, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 5, CopyId = 11, DateOfRental = new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 1, DateOfRental = new DateTime(2005, 7, 6, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 7, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 7, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 19, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }); }); modelBuilder.Entity("CodeFirst.Models.Models.Starring", b => { b.Property<int>("ActorId") .HasColumnType("integer") .HasColumnName("actor_id"); b.Property<int>("MovieId") .HasColumnType("integer") .HasColumnName("movie_id"); b.HasKey("ActorId", "MovieId"); b.HasIndex("MovieId"); b.ToTable("starring"); b.HasData( new { ActorId = 2, MovieId = 1 }, new { ActorId = 3, MovieId = 1 }, new { ActorId = 4, MovieId = 1 }, new { ActorId = 5, MovieId = 1 }, new { ActorId = 6, MovieId = 1 }, new { ActorId = 7, MovieId = 1 }, new { ActorId = 8, MovieId = 1 }, new { ActorId = 1, MovieId = 3 }, new { ActorId = 9, MovieId = 3 }, new { ActorId = 10, MovieId = 3 }, new { ActorId = 11, MovieId = 2 }, new { ActorId = 12, MovieId = 2 }, new { ActorId = 13, MovieId = 2 }, new { ActorId = 14, MovieId = 4 }, new { ActorId = 15, MovieId = 4 }, new { ActorId = 16, MovieId = 4 }, new { ActorId = 17, MovieId = 4 }, new { ActorId = 18, MovieId = 5 }, new { ActorId = 19, MovieId = 5 }, new { ActorId = 20, MovieId = 5 }, new { ActorId = 21, MovieId = 6 }, new { ActorId = 22, MovieId = 6 }, new { ActorId = 14, MovieId = 7 }, new { ActorId = 23, MovieId = 7 }, new { ActorId = 14, MovieId = 8 }, new { ActorId = 24, MovieId = 8 }, new { ActorId = 25, MovieId = 8 }, new { ActorId = 23, MovieId = 9 }, new { ActorId = 27, MovieId = 9 }, new { ActorId = 23, MovieId = 10 }, new { ActorId = 28, MovieId = 10 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.HasOne("CodeFirst.Models.Models.Movies", "Movie") .WithMany("Copies") .HasForeignKey("MovieId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Movie"); }); modelBuilder.Entity("CodeFirst.Models.Models.Rentals", b => { b.HasOne("CodeFirst.Models.Models.Clients", "Client") .WithMany("Rentals") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CodeFirst.Models.Models.Copies", "Copy") .WithMany("Rentals") .HasForeignKey("CopyId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Client"); b.Navigation("Copy"); }); modelBuilder.Entity("CodeFirst.Models.Models.Starring", b => { b.HasOne("CodeFirst.Models.Models.Actors", "Actor") .WithMany("Starring") .HasForeignKey("ActorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CodeFirst.Models.Models.Movies", "Movie") .WithMany("Starring") .HasForeignKey("MovieId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Actor"); b.Navigation("Movie"); }); modelBuilder.Entity("CodeFirst.Models.Models.Actors", b => { b.Navigation("Starring"); }); modelBuilder.Entity("CodeFirst.Models.Models.Clients", b => { b.Navigation("Rentals"); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.Navigation("Rentals"); }); modelBuilder.Entity("CodeFirst.Models.Models.Movies", b => { b.Navigation("Copies"); b.Navigation("Starring"); }); #pragma warning restore 612, 618 } } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Migrations/20220124205348_PostgreSqlInitialMigration.Designer.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
6,668
```smalltalk using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace CodeFirst.DataAccess.Migrations { public partial class PostgreSqlInitialMigration : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "actors", columns: table => new { actor_id = table.Column<int>(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), first_name = table.Column<string>(type: "text", nullable: true), last_name = table.Column<string>(type: "text", nullable: true), birthday = table.Column<DateTime>(type: "timestamp without time zone", nullable: true) }, constraints: table => { table.PrimaryKey("actor_pkey", x => x.actor_id); }); migrationBuilder.CreateTable( name: "clients", columns: table => new { client_id = table.Column<int>(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), first_name = table.Column<string>(type: "text", nullable: true), last_name = table.Column<string>(type: "text", nullable: true), birthday = table.Column<DateTime>(type: "timestamp without time zone", nullable: true) }, constraints: table => { table.PrimaryKey("client_pkey", x => x.client_id); }); migrationBuilder.CreateTable( name: "employees", columns: table => new { employee_id = table.Column<int>(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), first_name = table.Column<string>(type: "text", nullable: false), last_name = table.Column<string>(type: "text", nullable: false), salary = table.Column<float>(type: "real", nullable: true), City = table.Column<string>(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("employee_id", x => x.employee_id); }); migrationBuilder.CreateTable( name: "movies", columns: table => new { movie_id = table.Column<int>(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), title = table.Column<string>(type: "text", nullable: true), year = table.Column<int>(type: "integer", nullable: false), age_restriction = table.Column<int>(type: "integer", nullable: false), price = table.Column<float>(type: "real", nullable: false) }, constraints: table => { table.PrimaryKey("movies_pkey", x => x.movie_id); }); migrationBuilder.CreateTable( name: "copies", columns: table => new { copy_id = table.Column<int>(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), available = table.Column<bool>(type: "boolean", nullable: false), movie_id = table.Column<int>(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("copies_pkey", x => x.copy_id); table.ForeignKey( name: "FK_copies_movies_movie_id", column: x => x.movie_id, principalTable: "movies", principalColumn: "movie_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "starring", columns: table => new { actor_id = table.Column<int>(type: "integer", nullable: false), movie_id = table.Column<int>(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_starring", x => new { x.actor_id, x.movie_id }); table.ForeignKey( name: "FK_starring_actors_actor_id", column: x => x.actor_id, principalTable: "actors", principalColumn: "actor_id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_starring_movies_movie_id", column: x => x.movie_id, principalTable: "movies", principalColumn: "movie_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "rentals", columns: table => new { copy_id = table.Column<int>(type: "integer", nullable: false), client_id = table.Column<int>(type: "integer", nullable: false), date_of_rental = table.Column<DateTime>(type: "timestamp without time zone", nullable: true), date_of_return = table.Column<DateTime>(type: "timestamp without time zone", nullable: true) }, constraints: table => { table.PrimaryKey("rentals_pkey", x => new { x.client_id, x.copy_id }); table.ForeignKey( name: "FK_rentals_clients_client_id", column: x => x.client_id, principalTable: "clients", principalColumn: "client_id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_rentals_copies_copy_id", column: x => x.copy_id, principalTable: "copies", principalColumn: "copy_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( table: "actors", columns: new[] { "actor_id", "birthday", "first_name", "last_name" }, values: new object[,] { { 1, new DateTime(1947, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), "Arnold", "Schwarzenegger" }, { 28, new DateTime(1962, 7, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), "Tom", "Cruise" }, { 27, new DateTime(1981, 6, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), "Natalie", "Portman" }, { 26, new DateTime(1958, 3, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), "Gary", "Oldman" }, { 24, new DateTime(1948, 3, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), "Billy", "Crystal" }, { 23, new DateTime(1948, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), "Jean", "Reno" }, { 22, new DateTime(1966, 6, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), "Emmanuelle", "Seigner" }, { 21, new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), "Harrison", "Ford" }, { 20, new DateTime(1965, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), "Charlie", "Sheen" }, { 19, new DateTime(1955, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), "Willem", "Dafoe" }, { 18, new DateTime(1949, 5, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), "Tom", "Berenger" }, { 17, new DateTime(1950, 2, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cybill", "Shepherd" }, { 16, new DateTime(1939, 5, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), "Harvey", "Keitel" }, { 15, new DateTime(1962, 11, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), "Jodie", "Foster" }, { 25, new DateTime(1963, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), "Lisa", "Kudrow" }, { 13, new DateTime(1949, 10, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), "Sigourney", "Weaver" }, { 12, new DateTime(1952, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Dan", "Aykroyd" }, { 11, new DateTime(1950, 9, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), "Bill", "Murray" }, { 10, new DateTime(1956, 9, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), "Linda", "Hamilton" }, { 9, new DateTime(1956, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), "Michael", "Biehn" }, { 8, new DateTime(1935, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Peter", "Mayhew" }, { 7, new DateTime(1944, 5, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), "David", "Prowse" }, { 6, new DateTime(1913, 5, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), "Peter", "Cushing" }, { 5, new DateTime(1914, 4, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), "Alec", "Guiness" }, { 4, new DateTime(1956, 10, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), "Carrie", "Fisher" }, { 3, new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), "Harrison", "Ford" }, { 2, new DateTime(1946, 2, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), "Anthony", "Daniels" }, { 14, new DateTime(1943, 8, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), "Robert", "De Niro" } }); migrationBuilder.InsertData( table: "clients", columns: new[] { "client_id", "birthday", "first_name", "last_name" }, values: new object[,] { { 6, new DateTime(1965, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), "Rick", "Sanchez" }, { 5, new DateTime(2012, 5, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), "Lisa", "Simpson" }, { 4, new DateTime(1977, 1, 23, 0, 0, 0, 0, DateTimeKind.Unspecified), "Bob", "Belcher" }, { 2, new DateTime(2011, 9, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), "Brian", "Griffin" }, { 1, new DateTime(1954, 4, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), "Hank", "Hill" }, { 3, new DateTime(1989, 3, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), "Gary", "Goodspeed" } }); migrationBuilder.InsertData( table: "employees", columns: new[] { "employee_id", "City", "first_name", "last_name", "salary" }, values: new object[,] { { 1, "New York", "John", "Smith", 150f }, { 2, "New York", "Ben", "Johnson", 250f }, { 3, "New Orleans", "Louis", "Armstrong", 75f }, { 4, "London", "John", "Lennon", 300f }, { 5, "London", "Peter", "Gabriel", 150f } }); migrationBuilder.InsertData( table: "movies", columns: new[] { "movie_id", "age_restriction", "price", "title", "year" }, values: new object[,] { { 8, 16, 10.5f, "Analyze This", 1999 }, { 7, 13, 9.5f, "Ronin", 1998 }, { 6, 15, 8.5f, "Frantic", 1988 }, { 5, 18, 5f, "Platoon", 1986 }, { 1, 12, 10f, "Star Wars Episode IV: A New Hope", 1979 }, { 3, 15, 8.5f, "Terminator", 1984 }, { 2, 12, 5.5f, "Ghostbusters", 1984 }, { 9, 16, 8.5f, "Leon: the Professional", 1994 }, { 4, 17, 5f, "Taxi Driver", 1976 }, { 10, 13, 8.5f, "Mission Impossible", 1996 } }); migrationBuilder.InsertData( table: "copies", columns: new[] { "copy_id", "available", "movie_id" }, values: new object[,] { { 1, true, 1 }, { 11, true, 6 }, { 8, false, 5 }, { 12, true, 7 }, { 13, true, 7 }, { 7, true, 4 }, { 14, false, 8 }, { 6, true, 3 }, { 10, false, 6 }, { 4, true, 3 }, { 5, false, 3 }, { 17, false, 10 }, { 2, false, 1 }, { 20, true, 10 }, { 19, true, 10 }, { 18, true, 10 }, { 15, true, 9 }, { 9, true, 6 }, { 3, true, 2 }, { 16, true, 10 } }); migrationBuilder.InsertData( table: "starring", columns: new[] { "actor_id", "movie_id" }, values: new object[,] { { 23, 7 }, { 14, 8 }, { 14, 7 }, { 27, 9 }, { 23, 9 }, { 22, 6 }, { 21, 6 }, { 24, 8 }, { 25, 8 }, { 18, 5 }, { 19, 5 }, { 2, 1 }, { 3, 1 }, { 4, 1 }, { 5, 1 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 11, 2 }, { 20, 5 }, { 12, 2 }, { 1, 3 }, { 9, 3 }, { 10, 3 }, { 14, 4 }, { 15, 4 }, { 16, 4 }, { 17, 4 }, { 23, 10 }, { 13, 2 }, { 28, 10 } }); migrationBuilder.InsertData( table: "rentals", columns: new[] { "client_id", "copy_id", "date_of_rental", "date_of_return" }, values: new object[,] { { 1, 1, new DateTime(2005, 7, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 6, 1, new DateTime(2005, 7, 6, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 7, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 2, 3, new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 3, 3, new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 23, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 2, 5, new DateTime(2005, 7, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 27, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 1, 6, new DateTime(2005, 7, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 2, 7, new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 3, 7, new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 6, 7, new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 5, 11, new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 3, 12, new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 4, 13, new DateTime(2005, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 6, 19, new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 3, 20, new DateTime(2005, 7, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) } }); migrationBuilder.CreateIndex( name: "IX_copies_movie_id", table: "copies", column: "movie_id"); migrationBuilder.CreateIndex( name: "IX_rentals_copy_id", table: "rentals", column: "copy_id"); migrationBuilder.CreateIndex( name: "IX_starring_movie_id", table: "starring", column: "movie_id"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "employees"); migrationBuilder.DropTable( name: "rentals"); migrationBuilder.DropTable( name: "starring"); migrationBuilder.DropTable( name: "clients"); migrationBuilder.DropTable( name: "copies"); migrationBuilder.DropTable( name: "actors"); migrationBuilder.DropTable( name: "movies"); } } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Migrations/20220124205348_PostgreSqlInitialMigration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
4,710
```unknown Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31606.5 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8463ED7E-69FB-49AE-85CF-0791AFD98E38}" ProjectSection(SolutionItems) = preProject test\Directory.Build.props = test\Directory.Build.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DBD7D9B6-FCC7-4650-91AF-E6457573A68F}" ProjectSection(SolutionItems) = preProject src\Directory.Build.props = src\Directory.Build.props EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{25E69107-C89E-4807-AA31-C49423F0F1E3}" ProjectSection(SolutionItems) = preProject .deployment = .deployment .editorconfig = .editorconfig CHANGELOG.md = CHANGELOG.md Directory.Build.props = Directory.Build.props Generate-ReleaseNotes.bat = Generate-ReleaseNotes.bat LICENSE = LICENSE NuGet.txt = NuGet.txt PackageReadme.md = PackageReadme.md README.md = README.md version.xml = version.xml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core", "src\System.Linq.Dynamic.Core\System.Linq.Dynamic.Core.csproj", "{D3804228-91F4-4502-9595-39584E510002}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFramework.DynamicLinq", "src\EntityFramework.DynamicLinq\EntityFramework.DynamicLinq.csproj", "{D3804228-91F4-4502-9595-39584E510000}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore2", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore2\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore2.csproj", "{D3804228-91F4-4502-9595-39584E510001}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests", "test\System.Linq.Dynamic.Core.Tests\System.Linq.Dynamic.Core.Tests.csproj", "{912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}" ProjectSection(ProjectDependencies) = postProject {D3804228-91F4-4502-9595-39584E510001} = {D3804228-91F4-4502-9595-39584E510001} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFramework.DynamicLinq.Tests", "test\EntityFramework.DynamicLinq.Tests\EntityFramework.DynamicLinq.Tests.csproj", "{BF97CB1B-5043-4256-8F42-CF3A4F3863BE}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test-console", "test-console", "{7971CAEB-B9F2-416B-966D-2D697C4C1E62}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test-xamarin", "test-xamarin", "{ECA5702B-5D32-4888-A34E-9461FC533F23}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore2.0_EF2.0.1", "src-console\ConsoleAppEF2.0\ConsoleApp_netcore2.0_EF2.0.1.csproj", "{60CE11E0-E057-45A2-8F8A-73B1BD045BFB}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp_net452_EF6", "src-console\ConsoleApp_net452_EF6\ConsoleApp_net452_EF6.csproj", "{5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore2.0_EF2.0.2_InMemory", "src-console\ConsoleAppEF2.0.2_InMemory\ConsoleApp_netcore2.0_EF2.0.2_InMemory.csproj", "{437473EE-7FBB-4C28-96EC-41E1AEE161F3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore2.0_EF2.1", "src-console\ConsoleAppEF2.1\ConsoleApp_netcore2.0_EF2.1.csproj", "{EDF434F6-70C0-4005-B63E-0C365B3DA42A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore2.1_EF2.1.1", "src-console\ConsoleAppEF2.1.1\ConsoleApp_netcore2.1_EF2.1.1.csproj", "{F1880F07-238F-4A3A-9E58-141350665E1F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp_net452_EF6_Effort", "src-console\ConsoleApp_net452_EF6_Effort\ConsoleApp_net452_EF6_Effort.csproj", "{36B101B1-720B-4770-B222-C6ADD464F9EC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Z.EntityFramework.Classic.DynamicLinq", "src\Z.EntityFramework.Classic.DynamicLinq\Z.EntityFramework.Classic.DynamicLinq.csproj", "{D3804228-91F4-4502-9595-39584EA20000}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp.EntityFrameworkClassic", "src-console\ConsoleApp.EntityFrameworkClassic\ConsoleApp.EntityFrameworkClassic.csproj", "{0077F262-D69B-44D2-8A7C-87D8D19022A6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore3.1_EF3.1", "src-console\ConsoleAppEF3.1\ConsoleApp_netcore3.1_EF3.1.csproj", "{6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore2.1_CosmosDb", "src-console\ConsoleApp_netcore2.1_CosmosDb\ConsoleApp_netcore2.1_CosmosDb.csproj", "{D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp_net452_CosmosDb", "src-console\ConsoleApp_net452_CosmosDb\ConsoleApp_net452_CosmosDb.csproj", "{0034821E-740D-4553-821B-14CE9213C43C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src-blazor", "src-blazor", "{122BC4FA-7563-4E35-9D17-077F16F1629F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorAppTest", "src-blazor\BlazorAppTest\BlazorAppTest.csproj", "{CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docfx", "docfx", "{012536E6-FFF6-4BF8-AB9F-196017FBB257}" ProjectSection(SolutionItems) = preProject docfx\build-docs.ps1 = docfx\build-docs.ps1 docfx\docfx.json = docfx\docfx.json docfx\howto.txt = docfx\howto.txt docfx\index.md = docfx\index.md docfx\toc.yml = docfx\toc.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore3", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore3\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore3.csproj", "{7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore5", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore5\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore5.csproj", "{D3804228-91F4-4502-9595-39584E519901}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_net5.0_EF5", "src-console\ConsoleAppEF5\ConsoleApp_net5.0_EF5.csproj", "{B3D1A89E-CE12-4A0D-B23E-8970D681C719}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExpressionSample", "test-xamarin\ExpressionSample\ExpressionSample\ExpressionSample.csproj", "{060F5395-623F-464F-9C84-120E9496CBBA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExpressionSample.UWP", "test-xamarin\ExpressionSample\ExpressionSample.UWP\ExpressionSample.UWP.csproj", "{C7020A29-724F-40D3-9493-E6E9C018DE57}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestSLDC", "test-xamarin\TestSLDC\TestSLDC.csproj", "{C530A693-66FD-48A9-B42A-D613BB4CB754}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_net5.0_EF5_InMemory", "src-console\ConsoleAppEF5_InMemory\ConsoleApp_net5.0_EF5_InMemory.csproj", "{1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_netcore3.1_nhibernate", "src-console\ConsoleAppEF3.1_nhibernate\ConsoleApp_netcore3.1_nhibernate.csproj", "{38FDDF50-5F86-4B6D-9062-F687C6FD41A8}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestSLDC.Android", "test-xamarin\TestSLDC.Android\TestSLDC.Android.csproj", "{85D70423-5800-41E9-B7D5-244AAF051A85}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExpressionSample.Android", "test-xamarin\ExpressionSample\ExpressionSample.Android\ExpressionSample.Android.csproj", "{CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWASMExample", "src-blazor\BlazorWASMExample\BlazorWASMExample.csproj", "{3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore6", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore6\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore6.csproj", "{D28F6393-B56B-40A2-AF67-E8D669F42546}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_net6.0_EF6_InMemory", "src-console\ConsoleAppEF6_InMemory\ConsoleApp_net6.0_EF6_InMemory.csproj", "{4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_net6.0", "src-console\ConsoleApp_net6.0\ConsoleApp_net6.0.csproj", "{C206917D-6E90-4A31-8533-AF2DD68FF738}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Actions", "Actions", "{A42F1470-7801-4A19-BCA3-08AF24F3BFC5}" ProjectSection(SolutionItems) = preProject .github\workflows\ci.yml = .github\workflows\ci.yml .github\workflows\CreateRelease.yml = .github\workflows\CreateRelease.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests.Net5", "test\System.Linq.Dynamic.Core.Tests.Net5\System.Linq.Dynamic.Core.Tests.Net5.csproj", "{2AC8773A-FCDD-4613-8758-E45E5F10CA3A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests.Net6", "test\System.Linq.Dynamic.Core.Tests.Net6\System.Linq.Dynamic.Core.Tests.Net6.csproj", "{EDAB46DA-7079-42D7-819D-1932C542872F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorAppServer", "src-blazor\BlazorAppServer\BlazorAppServer.csproj", "{B133DA55-339D-4600-AED3-46214AD9F08A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore7", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore7\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore7.csproj", "{FB2F4C99-EC34-4D29-87E2-944B25D90EF7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests.Net7", "test\System.Linq.Dynamic.Core.Tests.Net7\System.Linq.Dynamic.Core.Tests.Net7.csproj", "{CC63ECEB-18C1-462B-BAFC-7F146A7C2740}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj", "{9000129D-322D-4FE6-9C47-75464577C374}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RadzenDataGrid.BlazorApp", "src-blazor\RadzenDataGrid.BlazorApp\RadzenDataGrid.BlazorApp.csproj", "{51074A4C-15C2-4E72-81F2-2FC53903553B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp_net6.0_EF6_Sqlite", "src-console\ConsoleAppEF6_Sqlite\ConsoleApp_net6.0_EF6_Sqlite.csproj", "{CA03FD55-9DAB-4827-9A35-A96D3804B311}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src-examples", "src-examples", "{BCA2A024-9032-4E56-A6C4-17A15D921728}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeFirst.DataAccess", "src-examples\CodeFirst.DataAccess\CodeFirst.DataAccess.csproj", "{E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeFirst.ConsoleApp", "src-examples\CodeFirst.ConsoleApp\CodeFirst.ConsoleApp.csproj", "{9E0D0994-7D84-40FF-8383-189F142FEF11}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeFirst.ConsoleApp8", "src-examples\CodeFirst.ConsoleApp8\CodeFirst.ConsoleApp8.csproj", "{68C7FF71-54F6-4D68-B419-65D1B10206D4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Host", "src-console\Demo.Host\Demo.Host.csproj", "{D8368319-F370-4071-9411-A3DADB234330}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Plugin", "src-console\Demo.Plugin\Demo.Plugin.csproj", "{B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests.NetCoreApp31", "test\System.Linq.Dynamic.Core.Tests.NetCoreApp31\System.Linq.Dynamic.Core.Tests.NetCoreApp31.csproj", "{7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WasmDynamicLinq", "src-blazor\WasmDynamicLinq\WasmDynamicLinq.csproj", "{2DE2052F-0A50-40C7-B6FF-52B52386BF9A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|ARM = Release|ARM Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {D3804228-91F4-4502-9595-39584E510002}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Debug|ARM.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Debug|ARM.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Debug|x64.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Debug|x64.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Debug|x86.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Debug|x86.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Release|Any CPU.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Release|ARM.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Release|ARM.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Release|x64.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Release|x64.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Release|x86.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510002}.Release|x86.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Debug|ARM.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Debug|ARM.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Debug|x64.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Debug|x64.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Debug|x86.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Debug|x86.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Release|Any CPU.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Release|ARM.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Release|ARM.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Release|x64.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Release|x64.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Release|x86.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510000}.Release|x86.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Debug|ARM.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Debug|ARM.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Debug|x64.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Debug|x64.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Debug|x86.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Debug|x86.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Release|Any CPU.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Release|ARM.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Release|ARM.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Release|x64.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Release|x64.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Release|x86.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E510001}.Release|x86.Build.0 = Release|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Debug|Any CPU.Build.0 = Debug|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Debug|ARM.ActiveCfg = Debug|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Debug|ARM.Build.0 = Debug|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Debug|x64.ActiveCfg = Debug|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Debug|x64.Build.0 = Debug|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Debug|x86.ActiveCfg = Debug|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Debug|x86.Build.0 = Debug|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Release|Any CPU.ActiveCfg = Release|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Release|Any CPU.Build.0 = Release|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Release|ARM.ActiveCfg = Release|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Release|ARM.Build.0 = Release|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Release|x64.ActiveCfg = Release|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Release|x64.Build.0 = Release|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Release|x86.ActiveCfg = Release|Any CPU {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80}.Release|x86.Build.0 = Release|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Debug|ARM.ActiveCfg = Debug|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Debug|ARM.Build.0 = Debug|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Debug|x64.ActiveCfg = Debug|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Debug|x64.Build.0 = Debug|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Debug|x86.ActiveCfg = Debug|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Debug|x86.Build.0 = Debug|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Release|Any CPU.Build.0 = Release|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Release|ARM.ActiveCfg = Release|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Release|ARM.Build.0 = Release|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Release|x64.ActiveCfg = Release|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Release|x64.Build.0 = Release|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Release|x86.ActiveCfg = Release|Any CPU {BF97CB1B-5043-4256-8F42-CF3A4F3863BE}.Release|x86.Build.0 = Release|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Debug|Any CPU.Build.0 = Debug|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Debug|ARM.ActiveCfg = Debug|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Debug|ARM.Build.0 = Debug|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Debug|x64.ActiveCfg = Debug|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Debug|x64.Build.0 = Debug|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Debug|x86.ActiveCfg = Debug|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Debug|x86.Build.0 = Debug|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Release|Any CPU.ActiveCfg = Release|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Release|Any CPU.Build.0 = Release|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Release|ARM.ActiveCfg = Release|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Release|ARM.Build.0 = Release|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Release|x64.ActiveCfg = Release|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Release|x64.Build.0 = Release|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Release|x86.ActiveCfg = Release|Any CPU {60CE11E0-E057-45A2-8F8A-73B1BD045BFB}.Release|x86.Build.0 = Release|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Debug|Any CPU.Build.0 = Debug|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Debug|ARM.ActiveCfg = Debug|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Debug|ARM.Build.0 = Debug|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Debug|x64.ActiveCfg = Debug|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Debug|x64.Build.0 = Debug|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Debug|x86.ActiveCfg = Debug|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Debug|x86.Build.0 = Debug|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Release|Any CPU.ActiveCfg = Release|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Release|Any CPU.Build.0 = Release|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Release|ARM.ActiveCfg = Release|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Release|ARM.Build.0 = Release|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Release|x64.ActiveCfg = Release|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Release|x64.Build.0 = Release|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Release|x86.ActiveCfg = Release|Any CPU {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C}.Release|x86.Build.0 = Release|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Debug|ARM.ActiveCfg = Debug|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Debug|ARM.Build.0 = Debug|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Debug|x64.ActiveCfg = Debug|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Debug|x64.Build.0 = Debug|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Debug|x86.ActiveCfg = Debug|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Debug|x86.Build.0 = Debug|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|Any CPU.Build.0 = Release|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|ARM.ActiveCfg = Release|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|ARM.Build.0 = Release|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|x64.ActiveCfg = Release|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|x64.Build.0 = Release|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|x86.ActiveCfg = Release|Any CPU {437473EE-7FBB-4C28-96EC-41E1AEE161F3}.Release|x86.Build.0 = Release|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Debug|Any CPU.Build.0 = Debug|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Debug|ARM.ActiveCfg = Debug|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Debug|ARM.Build.0 = Debug|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Debug|x64.ActiveCfg = Debug|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Debug|x64.Build.0 = Debug|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Debug|x86.ActiveCfg = Debug|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Debug|x86.Build.0 = Debug|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Release|Any CPU.ActiveCfg = Release|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Release|Any CPU.Build.0 = Release|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Release|ARM.ActiveCfg = Release|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Release|ARM.Build.0 = Release|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Release|x64.ActiveCfg = Release|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Release|x64.Build.0 = Release|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Release|x86.ActiveCfg = Release|Any CPU {EDF434F6-70C0-4005-B63E-0C365B3DA42A}.Release|x86.Build.0 = Release|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Debug|ARM.ActiveCfg = Debug|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Debug|ARM.Build.0 = Debug|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Debug|x64.ActiveCfg = Debug|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Debug|x64.Build.0 = Debug|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Debug|x86.ActiveCfg = Debug|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Debug|x86.Build.0 = Debug|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Release|Any CPU.Build.0 = Release|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Release|ARM.ActiveCfg = Release|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Release|ARM.Build.0 = Release|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Release|x64.ActiveCfg = Release|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Release|x64.Build.0 = Release|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Release|x86.ActiveCfg = Release|Any CPU {F1880F07-238F-4A3A-9E58-141350665E1F}.Release|x86.Build.0 = Release|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|Any CPU.Build.0 = Debug|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|ARM.ActiveCfg = Debug|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|ARM.Build.0 = Debug|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|x64.ActiveCfg = Debug|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|x64.Build.0 = Debug|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|x86.ActiveCfg = Debug|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Debug|x86.Build.0 = Debug|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|Any CPU.ActiveCfg = Release|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|Any CPU.Build.0 = Release|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|ARM.ActiveCfg = Release|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|ARM.Build.0 = Release|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|x64.ActiveCfg = Release|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|x64.Build.0 = Release|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|x86.ActiveCfg = Release|Any CPU {36B101B1-720B-4770-B222-C6ADD464F9EC}.Release|x86.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Debug|ARM.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Debug|ARM.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Debug|x64.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Debug|x64.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Debug|x86.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Debug|x86.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Release|Any CPU.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Release|ARM.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Release|ARM.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Release|x64.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Release|x64.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Release|x86.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584EA20000}.Release|x86.Build.0 = Release|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Debug|Any CPU.Build.0 = Debug|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Debug|ARM.ActiveCfg = Debug|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Debug|ARM.Build.0 = Debug|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Debug|x64.ActiveCfg = Debug|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Debug|x64.Build.0 = Debug|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Debug|x86.ActiveCfg = Debug|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Debug|x86.Build.0 = Debug|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Release|Any CPU.ActiveCfg = Release|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Release|Any CPU.Build.0 = Release|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Release|ARM.ActiveCfg = Release|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Release|ARM.Build.0 = Release|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Release|x64.ActiveCfg = Release|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Release|x64.Build.0 = Release|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Release|x86.ActiveCfg = Release|Any CPU {0077F262-D69B-44D2-8A7C-87D8D19022A6}.Release|x86.Build.0 = Release|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Debug|Any CPU.Build.0 = Debug|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Debug|ARM.ActiveCfg = Debug|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Debug|ARM.Build.0 = Debug|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Debug|x64.ActiveCfg = Debug|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Debug|x64.Build.0 = Debug|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Debug|x86.ActiveCfg = Debug|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Debug|x86.Build.0 = Debug|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|Any CPU.ActiveCfg = Release|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|Any CPU.Build.0 = Release|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|ARM.ActiveCfg = Release|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|ARM.Build.0 = Release|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|x64.ActiveCfg = Release|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|x64.Build.0 = Release|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|x86.ActiveCfg = Release|Any CPU {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A}.Release|x86.Build.0 = Release|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|Any CPU.Build.0 = Debug|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|ARM.ActiveCfg = Debug|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|ARM.Build.0 = Debug|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|x64.ActiveCfg = Debug|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|x64.Build.0 = Debug|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|x86.ActiveCfg = Debug|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Debug|x86.Build.0 = Debug|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|Any CPU.ActiveCfg = Release|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|Any CPU.Build.0 = Release|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|ARM.ActiveCfg = Release|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|ARM.Build.0 = Release|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|x64.ActiveCfg = Release|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|x64.Build.0 = Release|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|x86.ActiveCfg = Release|Any CPU {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB}.Release|x86.Build.0 = Release|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Debug|Any CPU.Build.0 = Debug|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Debug|ARM.ActiveCfg = Debug|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Debug|ARM.Build.0 = Debug|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Debug|x64.ActiveCfg = Debug|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Debug|x64.Build.0 = Debug|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Debug|x86.ActiveCfg = Debug|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Debug|x86.Build.0 = Debug|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Release|Any CPU.ActiveCfg = Release|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Release|Any CPU.Build.0 = Release|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Release|ARM.ActiveCfg = Release|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Release|ARM.Build.0 = Release|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Release|x64.ActiveCfg = Release|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Release|x64.Build.0 = Release|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Release|x86.ActiveCfg = Release|Any CPU {0034821E-740D-4553-821B-14CE9213C43C}.Release|x86.Build.0 = Release|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Debug|ARM.ActiveCfg = Debug|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Debug|ARM.Build.0 = Debug|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Debug|x64.ActiveCfg = Debug|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Debug|x64.Build.0 = Debug|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Debug|x86.ActiveCfg = Debug|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Debug|x86.Build.0 = Debug|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Release|Any CPU.ActiveCfg = Release|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Release|Any CPU.Build.0 = Release|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Release|ARM.ActiveCfg = Release|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Release|ARM.Build.0 = Release|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Release|x64.ActiveCfg = Release|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Release|x64.Build.0 = Release|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Release|x86.ActiveCfg = Release|Any CPU {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8}.Release|x86.Build.0 = Release|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Debug|ARM.ActiveCfg = Debug|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Debug|ARM.Build.0 = Debug|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Debug|x64.ActiveCfg = Debug|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Debug|x64.Build.0 = Debug|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Debug|x86.ActiveCfg = Debug|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Debug|x86.Build.0 = Debug|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|Any CPU.Build.0 = Release|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|ARM.ActiveCfg = Release|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|ARM.Build.0 = Release|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|x64.ActiveCfg = Release|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|x64.Build.0 = Release|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|x86.ActiveCfg = Release|Any CPU {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE}.Release|x86.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Debug|Any CPU.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Debug|ARM.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Debug|ARM.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Debug|x64.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Debug|x64.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Debug|x86.ActiveCfg = Debug|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Debug|x86.Build.0 = Debug|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Release|Any CPU.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Release|Any CPU.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Release|ARM.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Release|ARM.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Release|x64.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Release|x64.Build.0 = Release|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Release|x86.ActiveCfg = Release|Any CPU {D3804228-91F4-4502-9595-39584E519901}.Release|x86.Build.0 = Release|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Debug|Any CPU.Build.0 = Debug|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Debug|ARM.ActiveCfg = Debug|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Debug|ARM.Build.0 = Debug|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Debug|x64.ActiveCfg = Debug|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Debug|x64.Build.0 = Debug|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Debug|x86.ActiveCfg = Debug|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Debug|x86.Build.0 = Debug|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Release|Any CPU.Build.0 = Release|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Release|ARM.ActiveCfg = Release|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Release|ARM.Build.0 = Release|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Release|x64.ActiveCfg = Release|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Release|x64.Build.0 = Release|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Release|x86.ActiveCfg = Release|Any CPU {B3D1A89E-CE12-4A0D-B23E-8970D681C719}.Release|x86.Build.0 = Release|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Debug|Any CPU.Build.0 = Debug|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Debug|ARM.ActiveCfg = Debug|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Debug|ARM.Build.0 = Debug|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Debug|x64.ActiveCfg = Debug|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Debug|x64.Build.0 = Debug|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Debug|x86.ActiveCfg = Debug|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Debug|x86.Build.0 = Debug|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Release|Any CPU.ActiveCfg = Release|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Release|Any CPU.Build.0 = Release|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Release|ARM.ActiveCfg = Release|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Release|ARM.Build.0 = Release|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Release|x64.ActiveCfg = Release|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Release|x64.Build.0 = Release|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Release|x86.ActiveCfg = Release|Any CPU {060F5395-623F-464F-9C84-120E9496CBBA}.Release|x86.Build.0 = Release|Any CPU {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|Any CPU.ActiveCfg = Debug|x86 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|ARM.ActiveCfg = Debug|ARM {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|ARM.Build.0 = Debug|ARM {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|ARM.Deploy.0 = Debug|ARM {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|x64.ActiveCfg = Debug|x64 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|x64.Build.0 = Debug|x64 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|x64.Deploy.0 = Debug|x64 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|x86.ActiveCfg = Debug|x86 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|x86.Build.0 = Debug|x86 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Debug|x86.Deploy.0 = Debug|x86 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|Any CPU.ActiveCfg = Release|x86 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|ARM.ActiveCfg = Release|ARM {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|ARM.Build.0 = Release|ARM {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|ARM.Deploy.0 = Release|ARM {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|x64.ActiveCfg = Release|x64 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|x64.Build.0 = Release|x64 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|x64.Deploy.0 = Release|x64 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|x86.ActiveCfg = Release|x86 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|x86.Build.0 = Release|x86 {C7020A29-724F-40D3-9493-E6E9C018DE57}.Release|x86.Deploy.0 = Release|x86 {C530A693-66FD-48A9-B42A-D613BB4CB754}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Debug|Any CPU.Build.0 = Debug|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Debug|ARM.ActiveCfg = Debug|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Debug|ARM.Build.0 = Debug|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Debug|x64.ActiveCfg = Debug|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Debug|x64.Build.0 = Debug|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Debug|x86.ActiveCfg = Debug|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Debug|x86.Build.0 = Debug|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Release|Any CPU.ActiveCfg = Release|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Release|Any CPU.Build.0 = Release|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Release|ARM.ActiveCfg = Release|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Release|ARM.Build.0 = Release|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Release|x64.ActiveCfg = Release|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Release|x64.Build.0 = Release|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Release|x86.ActiveCfg = Release|Any CPU {C530A693-66FD-48A9-B42A-D613BB4CB754}.Release|x86.Build.0 = Release|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Debug|Any CPU.Build.0 = Debug|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Debug|ARM.ActiveCfg = Debug|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Debug|ARM.Build.0 = Debug|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Debug|x64.ActiveCfg = Debug|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Debug|x64.Build.0 = Debug|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Debug|x86.ActiveCfg = Debug|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Debug|x86.Build.0 = Debug|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Release|Any CPU.ActiveCfg = Release|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Release|Any CPU.Build.0 = Release|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Release|ARM.ActiveCfg = Release|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Release|ARM.Build.0 = Release|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Release|x64.ActiveCfg = Release|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Release|x64.Build.0 = Release|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Release|x86.ActiveCfg = Release|Any CPU {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC}.Release|x86.Build.0 = Release|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Debug|Any CPU.Build.0 = Debug|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Debug|ARM.ActiveCfg = Debug|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Debug|ARM.Build.0 = Debug|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Debug|x64.ActiveCfg = Debug|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Debug|x64.Build.0 = Debug|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Debug|x86.ActiveCfg = Debug|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Debug|x86.Build.0 = Debug|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Release|Any CPU.ActiveCfg = Release|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Release|Any CPU.Build.0 = Release|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Release|ARM.ActiveCfg = Release|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Release|ARM.Build.0 = Release|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Release|x64.ActiveCfg = Release|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Release|x64.Build.0 = Release|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Release|x86.ActiveCfg = Release|Any CPU {38FDDF50-5F86-4B6D-9062-F687C6FD41A8}.Release|x86.Build.0 = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|Any CPU.Build.0 = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|ARM.ActiveCfg = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|ARM.Build.0 = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|ARM.Deploy.0 = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x64.ActiveCfg = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x64.Build.0 = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x64.Deploy.0 = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x86.ActiveCfg = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x86.Build.0 = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Debug|x86.Deploy.0 = Debug|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|Any CPU.ActiveCfg = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|Any CPU.Build.0 = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|Any CPU.Deploy.0 = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|ARM.ActiveCfg = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|ARM.Build.0 = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|ARM.Deploy.0 = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x64.ActiveCfg = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x64.Build.0 = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x64.Deploy.0 = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x86.ActiveCfg = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x86.Build.0 = Release|Any CPU {85D70423-5800-41E9-B7D5-244AAF051A85}.Release|x86.Deploy.0 = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|ARM.ActiveCfg = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|ARM.Build.0 = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|ARM.Deploy.0 = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|x64.ActiveCfg = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|x64.Build.0 = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|x64.Deploy.0 = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|x86.ActiveCfg = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|x86.Build.0 = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Debug|x86.Deploy.0 = Debug|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|Any CPU.Build.0 = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|Any CPU.Deploy.0 = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|ARM.ActiveCfg = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|ARM.Build.0 = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|ARM.Deploy.0 = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|x64.ActiveCfg = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|x64.Build.0 = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|x64.Deploy.0 = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|x86.ActiveCfg = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|x86.Build.0 = Release|Any CPU {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3}.Release|x86.Deploy.0 = Release|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Debug|Any CPU.Build.0 = Debug|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Debug|ARM.ActiveCfg = Debug|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Debug|ARM.Build.0 = Debug|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Debug|x64.ActiveCfg = Debug|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Debug|x64.Build.0 = Debug|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Debug|x86.ActiveCfg = Debug|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Debug|x86.Build.0 = Debug|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Release|Any CPU.ActiveCfg = Release|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Release|Any CPU.Build.0 = Release|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Release|ARM.ActiveCfg = Release|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Release|ARM.Build.0 = Release|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Release|x64.ActiveCfg = Release|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Release|x64.Build.0 = Release|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Release|x86.ActiveCfg = Release|Any CPU {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655}.Release|x86.Build.0 = Release|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Debug|Any CPU.Build.0 = Debug|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Debug|ARM.ActiveCfg = Debug|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Debug|ARM.Build.0 = Debug|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Debug|x64.ActiveCfg = Debug|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Debug|x64.Build.0 = Debug|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Debug|x86.ActiveCfg = Debug|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Debug|x86.Build.0 = Debug|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Release|Any CPU.ActiveCfg = Release|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Release|Any CPU.Build.0 = Release|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Release|ARM.ActiveCfg = Release|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Release|ARM.Build.0 = Release|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Release|x64.ActiveCfg = Release|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Release|x64.Build.0 = Release|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Release|x86.ActiveCfg = Release|Any CPU {D28F6393-B56B-40A2-AF67-E8D669F42546}.Release|x86.Build.0 = Release|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Debug|Any CPU.Build.0 = Debug|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Debug|ARM.ActiveCfg = Debug|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Debug|ARM.Build.0 = Debug|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Debug|x64.ActiveCfg = Debug|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Debug|x64.Build.0 = Debug|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Debug|x86.ActiveCfg = Debug|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Debug|x86.Build.0 = Debug|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Release|Any CPU.ActiveCfg = Release|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Release|Any CPU.Build.0 = Release|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Release|ARM.ActiveCfg = Release|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Release|ARM.Build.0 = Release|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Release|x64.ActiveCfg = Release|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Release|x64.Build.0 = Release|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Release|x86.ActiveCfg = Release|Any CPU {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB}.Release|x86.Build.0 = Release|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Debug|Any CPU.Build.0 = Debug|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Debug|ARM.ActiveCfg = Debug|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Debug|ARM.Build.0 = Debug|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Debug|x64.ActiveCfg = Debug|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Debug|x64.Build.0 = Debug|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Debug|x86.ActiveCfg = Debug|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Debug|x86.Build.0 = Debug|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Release|Any CPU.ActiveCfg = Release|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Release|Any CPU.Build.0 = Release|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Release|ARM.ActiveCfg = Release|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Release|ARM.Build.0 = Release|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Release|x64.ActiveCfg = Release|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Release|x64.Build.0 = Release|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Release|x86.ActiveCfg = Release|Any CPU {C206917D-6E90-4A31-8533-AF2DD68FF738}.Release|x86.Build.0 = Release|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Debug|Any CPU.Build.0 = Debug|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Debug|ARM.ActiveCfg = Debug|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Debug|ARM.Build.0 = Debug|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Debug|x64.ActiveCfg = Debug|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Debug|x64.Build.0 = Debug|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Debug|x86.ActiveCfg = Debug|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Debug|x86.Build.0 = Debug|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Release|Any CPU.Build.0 = Release|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Release|ARM.ActiveCfg = Release|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Release|ARM.Build.0 = Release|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Release|x64.ActiveCfg = Release|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Release|x64.Build.0 = Release|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Release|x86.ActiveCfg = Release|Any CPU {2AC8773A-FCDD-4613-8758-E45E5F10CA3A}.Release|x86.Build.0 = Release|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Debug|Any CPU.Build.0 = Debug|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Debug|ARM.ActiveCfg = Debug|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Debug|ARM.Build.0 = Debug|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Debug|x64.ActiveCfg = Debug|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Debug|x64.Build.0 = Debug|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Debug|x86.ActiveCfg = Debug|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Debug|x86.Build.0 = Debug|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Release|Any CPU.ActiveCfg = Release|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Release|Any CPU.Build.0 = Release|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Release|ARM.ActiveCfg = Release|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Release|ARM.Build.0 = Release|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Release|x64.ActiveCfg = Release|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Release|x64.Build.0 = Release|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Release|x86.ActiveCfg = Release|Any CPU {EDAB46DA-7079-42D7-819D-1932C542872F}.Release|x86.Build.0 = Release|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Debug|Any CPU.Build.0 = Debug|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Debug|ARM.ActiveCfg = Debug|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Debug|ARM.Build.0 = Debug|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Debug|x64.ActiveCfg = Debug|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Debug|x64.Build.0 = Debug|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Debug|x86.ActiveCfg = Debug|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Debug|x86.Build.0 = Debug|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Release|Any CPU.ActiveCfg = Release|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Release|Any CPU.Build.0 = Release|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Release|ARM.ActiveCfg = Release|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Release|ARM.Build.0 = Release|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Release|x64.ActiveCfg = Release|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Release|x64.Build.0 = Release|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Release|x86.ActiveCfg = Release|Any CPU {B133DA55-339D-4600-AED3-46214AD9F08A}.Release|x86.Build.0 = Release|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Debug|ARM.ActiveCfg = Debug|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Debug|ARM.Build.0 = Debug|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Debug|x64.ActiveCfg = Debug|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Debug|x64.Build.0 = Debug|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Debug|x86.ActiveCfg = Debug|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Debug|x86.Build.0 = Debug|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Release|Any CPU.Build.0 = Release|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Release|ARM.ActiveCfg = Release|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Release|ARM.Build.0 = Release|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Release|x64.ActiveCfg = Release|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Release|x64.Build.0 = Release|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Release|x86.ActiveCfg = Release|Any CPU {FB2F4C99-EC34-4D29-87E2-944B25D90EF7}.Release|x86.Build.0 = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Debug|Any CPU.Build.0 = Debug|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Debug|ARM.ActiveCfg = Debug|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Debug|ARM.Build.0 = Debug|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Debug|x64.ActiveCfg = Debug|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Debug|x64.Build.0 = Debug|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Debug|x86.ActiveCfg = Debug|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Debug|x86.Build.0 = Debug|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|Any CPU.ActiveCfg = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|Any CPU.Build.0 = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|ARM.ActiveCfg = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|ARM.Build.0 = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|x64.ActiveCfg = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|x64.Build.0 = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|x86.ActiveCfg = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|x86.Build.0 = Release|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Debug|Any CPU.Build.0 = Debug|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Debug|ARM.ActiveCfg = Debug|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Debug|ARM.Build.0 = Debug|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Debug|x64.ActiveCfg = Debug|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Debug|x64.Build.0 = Debug|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Debug|x86.ActiveCfg = Debug|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Debug|x86.Build.0 = Debug|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Release|Any CPU.ActiveCfg = Release|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Release|Any CPU.Build.0 = Release|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Release|ARM.ActiveCfg = Release|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Release|ARM.Build.0 = Release|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Release|x64.ActiveCfg = Release|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Release|x64.Build.0 = Release|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Release|x86.ActiveCfg = Release|Any CPU {9000129D-322D-4FE6-9C47-75464577C374}.Release|x86.Build.0 = Release|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|Any CPU.Build.0 = Debug|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|ARM.ActiveCfg = Debug|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|ARM.Build.0 = Debug|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|x64.ActiveCfg = Debug|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|x64.Build.0 = Debug|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|x86.ActiveCfg = Debug|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Debug|x86.Build.0 = Debug|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Release|Any CPU.ActiveCfg = Release|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Release|Any CPU.Build.0 = Release|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Release|ARM.ActiveCfg = Release|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Release|ARM.Build.0 = Release|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Release|x64.ActiveCfg = Release|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Release|x64.Build.0 = Release|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Release|x86.ActiveCfg = Release|Any CPU {51074A4C-15C2-4E72-81F2-2FC53903553B}.Release|x86.Build.0 = Release|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Debug|Any CPU.Build.0 = Debug|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Debug|ARM.ActiveCfg = Debug|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Debug|ARM.Build.0 = Debug|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Debug|x64.ActiveCfg = Debug|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Debug|x64.Build.0 = Debug|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Debug|x86.ActiveCfg = Debug|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Debug|x86.Build.0 = Debug|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Release|Any CPU.ActiveCfg = Release|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Release|Any CPU.Build.0 = Release|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Release|ARM.ActiveCfg = Release|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Release|ARM.Build.0 = Release|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Release|x64.ActiveCfg = Release|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Release|x64.Build.0 = Release|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Release|x86.ActiveCfg = Release|Any CPU {CA03FD55-9DAB-4827-9A35-A96D3804B311}.Release|x86.Build.0 = Release|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Debug|Any CPU.Build.0 = Debug|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Debug|ARM.ActiveCfg = Debug|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Debug|ARM.Build.0 = Debug|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Debug|x64.ActiveCfg = Debug|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Debug|x64.Build.0 = Debug|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Debug|x86.ActiveCfg = Debug|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Debug|x86.Build.0 = Debug|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Release|Any CPU.ActiveCfg = Release|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Release|Any CPU.Build.0 = Release|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Release|ARM.ActiveCfg = Release|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Release|ARM.Build.0 = Release|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Release|x64.ActiveCfg = Release|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Release|x64.Build.0 = Release|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Release|x86.ActiveCfg = Release|Any CPU {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4}.Release|x86.Build.0 = Release|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Debug|Any CPU.Build.0 = Debug|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Debug|ARM.ActiveCfg = Debug|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Debug|ARM.Build.0 = Debug|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Debug|x64.ActiveCfg = Debug|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Debug|x64.Build.0 = Debug|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Debug|x86.ActiveCfg = Debug|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Debug|x86.Build.0 = Debug|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Release|Any CPU.Build.0 = Release|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Release|ARM.ActiveCfg = Release|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Release|ARM.Build.0 = Release|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Release|x64.ActiveCfg = Release|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Release|x64.Build.0 = Release|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Release|x86.ActiveCfg = Release|Any CPU {9E0D0994-7D84-40FF-8383-189F142FEF11}.Release|x86.Build.0 = Release|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Debug|ARM.ActiveCfg = Debug|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Debug|ARM.Build.0 = Debug|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Debug|x64.ActiveCfg = Debug|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Debug|x64.Build.0 = Debug|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Debug|x86.ActiveCfg = Debug|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Debug|x86.Build.0 = Debug|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Release|Any CPU.Build.0 = Release|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Release|ARM.ActiveCfg = Release|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Release|ARM.Build.0 = Release|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Release|x64.ActiveCfg = Release|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Release|x64.Build.0 = Release|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Release|x86.ActiveCfg = Release|Any CPU {68C7FF71-54F6-4D68-B419-65D1B10206D4}.Release|x86.Build.0 = Release|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Debug|Any CPU.Build.0 = Debug|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Debug|ARM.ActiveCfg = Debug|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Debug|ARM.Build.0 = Debug|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Debug|x64.ActiveCfg = Debug|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Debug|x64.Build.0 = Debug|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Debug|x86.ActiveCfg = Debug|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Debug|x86.Build.0 = Debug|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Release|Any CPU.ActiveCfg = Release|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Release|Any CPU.Build.0 = Release|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Release|ARM.ActiveCfg = Release|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Release|ARM.Build.0 = Release|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Release|x64.ActiveCfg = Release|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Release|x64.Build.0 = Release|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Release|x86.ActiveCfg = Release|Any CPU {D8368319-F370-4071-9411-A3DADB234330}.Release|x86.Build.0 = Release|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Debug|Any CPU.Build.0 = Debug|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Debug|ARM.ActiveCfg = Debug|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Debug|ARM.Build.0 = Debug|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Debug|x64.ActiveCfg = Debug|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Debug|x64.Build.0 = Debug|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Debug|x86.ActiveCfg = Debug|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Debug|x86.Build.0 = Debug|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|Any CPU.ActiveCfg = Release|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|Any CPU.Build.0 = Release|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|ARM.ActiveCfg = Release|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|ARM.Build.0 = Release|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|x64.ActiveCfg = Release|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|x64.Build.0 = Release|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|x86.ActiveCfg = Release|Any CPU {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C}.Release|x86.Build.0 = Release|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|Any CPU.Build.0 = Debug|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|ARM.ActiveCfg = Debug|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|ARM.Build.0 = Debug|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|x64.ActiveCfg = Debug|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|x64.Build.0 = Debug|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|x86.ActiveCfg = Debug|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Debug|x86.Build.0 = Debug|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|Any CPU.ActiveCfg = Release|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|Any CPU.Build.0 = Release|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|ARM.ActiveCfg = Release|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|ARM.Build.0 = Release|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|x64.ActiveCfg = Release|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|x64.Build.0 = Release|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|x86.ActiveCfg = Release|Any CPU {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616}.Release|x86.Build.0 = Release|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Debug|ARM.ActiveCfg = Debug|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Debug|ARM.Build.0 = Debug|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Debug|x64.ActiveCfg = Debug|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Debug|x64.Build.0 = Debug|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Debug|x86.ActiveCfg = Debug|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Debug|x86.Build.0 = Debug|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Release|Any CPU.Build.0 = Release|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Release|ARM.ActiveCfg = Release|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Release|ARM.Build.0 = Release|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Release|x64.ActiveCfg = Release|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Release|x64.Build.0 = Release|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Release|x86.ActiveCfg = Release|Any CPU {2DE2052F-0A50-40C7-B6FF-52B52386BF9A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {D3804228-91F4-4502-9595-39584E510002} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {D3804228-91F4-4502-9595-39584E510000} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {D3804228-91F4-4502-9595-39584E510001} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {912FBF24-3CAE-4A50-B5EA-E525B9FAEC80} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38} {BF97CB1B-5043-4256-8F42-CF3A4F3863BE} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38} {60CE11E0-E057-45A2-8F8A-73B1BD045BFB} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {5DC68E83-ABE0-4887-B17E-1ED4EEE89C2C} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {437473EE-7FBB-4C28-96EC-41E1AEE161F3} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {EDF434F6-70C0-4005-B63E-0C365B3DA42A} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {F1880F07-238F-4A3A-9E58-141350665E1F} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {36B101B1-720B-4770-B222-C6ADD464F9EC} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {D3804228-91F4-4502-9595-39584EA20000} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {0077F262-D69B-44D2-8A7C-87D8D19022A6} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {6D21EBF2-C92D-4AE0-9BC3-47C63928F88A} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {D160E2CF-A7E1-4DDE-9AB8-8CFB0087DCEB} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {0034821E-740D-4553-821B-14CE9213C43C} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {CD80A3AC-B0E1-45ED-BE07-DE6A0F1D4CD8} = {122BC4FA-7563-4E35-9D17-077F16F1629F} {7994FECC-965C-4A5D-8B0E-1A6EA769D4BE} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {D3804228-91F4-4502-9595-39584E519901} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {B3D1A89E-CE12-4A0D-B23E-8970D681C719} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {060F5395-623F-464F-9C84-120E9496CBBA} = {ECA5702B-5D32-4888-A34E-9461FC533F23} {C7020A29-724F-40D3-9493-E6E9C018DE57} = {ECA5702B-5D32-4888-A34E-9461FC533F23} {C530A693-66FD-48A9-B42A-D613BB4CB754} = {ECA5702B-5D32-4888-A34E-9461FC533F23} {1D30F4EB-3CD9-446C-BDFB-107F79F05BBC} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {38FDDF50-5F86-4B6D-9062-F687C6FD41A8} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {85D70423-5800-41E9-B7D5-244AAF051A85} = {ECA5702B-5D32-4888-A34E-9461FC533F23} {CE0965F5-C4DD-4CAB-94C6-FE260775D2B3} = {ECA5702B-5D32-4888-A34E-9461FC533F23} {3DA1CE3B-D1FB-4CEC-A4A6-22495CC36655} = {122BC4FA-7563-4E35-9D17-077F16F1629F} {D28F6393-B56B-40A2-AF67-E8D669F42546} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {4CC563F6-5352-4A77-A8C0-DC0D77A71DBB} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {C206917D-6E90-4A31-8533-AF2DD68FF738} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {A42F1470-7801-4A19-BCA3-08AF24F3BFC5} = {25E69107-C89E-4807-AA31-C49423F0F1E3} {2AC8773A-FCDD-4613-8758-E45E5F10CA3A} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38} {EDAB46DA-7079-42D7-819D-1932C542872F} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38} {B133DA55-339D-4600-AED3-46214AD9F08A} = {122BC4FA-7563-4E35-9D17-077F16F1629F} {FB2F4C99-EC34-4D29-87E2-944B25D90EF7} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {CC63ECEB-18C1-462B-BAFC-7F146A7C2740} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38} {9000129D-322D-4FE6-9C47-75464577C374} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {51074A4C-15C2-4E72-81F2-2FC53903553B} = {122BC4FA-7563-4E35-9D17-077F16F1629F} {CA03FD55-9DAB-4827-9A35-A96D3804B311} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {E36D1A08-F3ED-48C7-9DBF-8F625974A6C4} = {BCA2A024-9032-4E56-A6C4-17A15D921728} {9E0D0994-7D84-40FF-8383-189F142FEF11} = {BCA2A024-9032-4E56-A6C4-17A15D921728} {68C7FF71-54F6-4D68-B419-65D1B10206D4} = {BCA2A024-9032-4E56-A6C4-17A15D921728} {D8368319-F370-4071-9411-A3DADB234330} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {B01B327C-FC68-49B6-BDE3-A13D0C66DF5C} = {7971CAEB-B9F2-416B-966D-2D697C4C1E62} {7AFC2836-0F6E-4B0D-8BB3-13317A3B6616} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38} {2DE2052F-0A50-40C7-B6FF-52B52386BF9A} = {122BC4FA-7563-4E35-9D17-077F16F1629F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {94C56722-194E-4B8B-BC23-B3F754E89A20} EndGlobalSection GlobalSection(Performance) = preSolution HasPerformanceSessions = true EndGlobalSection EndGlobal ```
/content/code_sandbox/System.Linq.Dynamic.Core.sln
unknown
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
36,978
```smalltalk // <auto-generated /> using System; using CodeFirst.DataAccess.Context; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace CodeFirst.DataAccess.Migrations { [DbContext(typeof(PostgresDbContext))] partial class PostgresDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .UseIdentityByDefaultColumns() .HasAnnotation("Relational:MaxIdentifierLength", 63) .HasAnnotation("ProductVersion", "5.0.1"); modelBuilder.Entity("CodeFirst.Models.Models.Actors", b => { b.Property<int>("ActorId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("actor_id") .UseIdentityByDefaultColumn(); b.Property<DateTime?>("Birthday") .HasColumnType("timestamp without time zone") .HasColumnName("birthday"); b.Property<string>("Firstname") .HasColumnType("text") .HasColumnName("first_name"); b.Property<string>("Lastname") .HasColumnType("text") .HasColumnName("last_name"); b.HasKey("ActorId") .HasName("actor_pkey"); b.ToTable("actors"); b.HasData( new { ActorId = 1, Birthday = new DateTime(1947, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Arnold", Lastname = "Schwarzenegger" }, new { ActorId = 2, Birthday = new DateTime(1946, 2, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Anthony", Lastname = "Daniels" }, new { ActorId = 3, Birthday = new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harrison", Lastname = "Ford" }, new { ActorId = 4, Birthday = new DateTime(1956, 10, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Carrie", Lastname = "Fisher" }, new { ActorId = 5, Birthday = new DateTime(1914, 4, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Alec", Lastname = "Guiness" }, new { ActorId = 6, Birthday = new DateTime(1913, 5, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Peter", Lastname = "Cushing" }, new { ActorId = 7, Birthday = new DateTime(1944, 5, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "David", Lastname = "Prowse" }, new { ActorId = 8, Birthday = new DateTime(1935, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Peter", Lastname = "Mayhew" }, new { ActorId = 9, Birthday = new DateTime(1956, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Michael", Lastname = "Biehn" }, new { ActorId = 10, Birthday = new DateTime(1956, 9, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Linda", Lastname = "Hamilton" }, new { ActorId = 11, Birthday = new DateTime(1950, 9, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Bill", Lastname = "Murray" }, new { ActorId = 12, Birthday = new DateTime(1952, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Dan", Lastname = "Aykroyd" }, new { ActorId = 13, Birthday = new DateTime(1949, 10, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Sigourney", Lastname = "Weaver" }, new { ActorId = 14, Birthday = new DateTime(1943, 8, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Robert", Lastname = "De Niro" }, new { ActorId = 15, Birthday = new DateTime(1962, 11, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Jodie", Lastname = "Foster" }, new { ActorId = 16, Birthday = new DateTime(1939, 5, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harvey", Lastname = "Keitel" }, new { ActorId = 17, Birthday = new DateTime(1950, 2, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Cybill", Lastname = "Shepherd" }, new { ActorId = 18, Birthday = new DateTime(1949, 5, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Tom", Lastname = "Berenger" }, new { ActorId = 19, Birthday = new DateTime(1955, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Willem", Lastname = "Dafoe" }, new { ActorId = 20, Birthday = new DateTime(1965, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Charlie", Lastname = "Sheen" }, new { ActorId = 21, Birthday = new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harrison", Lastname = "Ford" }, new { ActorId = 22, Birthday = new DateTime(1966, 6, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Emmanuelle", Lastname = "Seigner" }, new { ActorId = 23, Birthday = new DateTime(1948, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Jean", Lastname = "Reno" }, new { ActorId = 24, Birthday = new DateTime(1948, 3, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Billy", Lastname = "Crystal" }, new { ActorId = 25, Birthday = new DateTime(1963, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Lisa", Lastname = "Kudrow" }, new { ActorId = 26, Birthday = new DateTime(1958, 3, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Gary", Lastname = "Oldman" }, new { ActorId = 27, Birthday = new DateTime(1981, 6, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Natalie", Lastname = "Portman" }, new { ActorId = 28, Birthday = new DateTime(1962, 7, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Tom", Lastname = "Cruise" }); }); modelBuilder.Entity("CodeFirst.Models.Models.Clients", b => { b.Property<int>("ClientId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("client_id") .UseIdentityByDefaultColumn(); b.Property<DateTime?>("Birthday") .HasColumnType("timestamp without time zone") .HasColumnName("birthday"); b.Property<string>("Firstname") .HasColumnType("text") .HasColumnName("first_name"); b.Property<string>("Lastname") .HasColumnType("text") .HasColumnName("last_name"); b.HasKey("ClientId") .HasName("client_pkey"); b.ToTable("clients"); b.HasData( new { ClientId = 1, Birthday = new DateTime(1954, 4, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Hank", Lastname = "Hill" }, new { ClientId = 2, Birthday = new DateTime(2011, 9, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Brian", Lastname = "Griffin" }, new { ClientId = 3, Birthday = new DateTime(1989, 3, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Gary", Lastname = "Goodspeed" }, new { ClientId = 4, Birthday = new DateTime(1977, 1, 23, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Bob", Lastname = "Belcher" }, new { ClientId = 5, Birthday = new DateTime(2012, 5, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Lisa", Lastname = "Simpson" }, new { ClientId = 6, Birthday = new DateTime(1965, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Rick", Lastname = "Sanchez" }); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.Property<int>("CopyId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("copy_id") .UseIdentityByDefaultColumn(); b.Property<bool>("Available") .HasColumnType("boolean") .HasColumnName("available"); b.Property<int>("MovieId") .HasColumnType("integer") .HasColumnName("movie_id"); b.HasKey("CopyId") .HasName("copies_pkey"); b.HasIndex("MovieId"); b.ToTable("copies"); b.HasData( new { CopyId = 1, Available = true, MovieId = 1 }, new { CopyId = 2, Available = false, MovieId = 1 }, new { CopyId = 3, Available = true, MovieId = 2 }, new { CopyId = 4, Available = true, MovieId = 3 }, new { CopyId = 5, Available = false, MovieId = 3 }, new { CopyId = 6, Available = true, MovieId = 3 }, new { CopyId = 7, Available = true, MovieId = 4 }, new { CopyId = 8, Available = false, MovieId = 5 }, new { CopyId = 9, Available = true, MovieId = 6 }, new { CopyId = 10, Available = false, MovieId = 6 }, new { CopyId = 11, Available = true, MovieId = 6 }, new { CopyId = 12, Available = true, MovieId = 7 }, new { CopyId = 13, Available = true, MovieId = 7 }, new { CopyId = 14, Available = false, MovieId = 8 }, new { CopyId = 15, Available = true, MovieId = 9 }, new { CopyId = 16, Available = true, MovieId = 10 }, new { CopyId = 17, Available = false, MovieId = 10 }, new { CopyId = 18, Available = true, MovieId = 10 }, new { CopyId = 19, Available = true, MovieId = 10 }, new { CopyId = 20, Available = true, MovieId = 10 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Employees", b => { b.Property<int>("EmployeeId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("employee_id") .UseIdentityByDefaultColumn(); b.Property<string>("City") .HasColumnType("text"); b.Property<string>("Firstname") .IsRequired() .HasColumnType("text") .HasColumnName("first_name"); b.Property<string>("Lastname") .IsRequired() .HasColumnType("text") .HasColumnName("last_name"); b.Property<float?>("Salary") .HasColumnType("real") .HasColumnName("salary"); b.HasKey("EmployeeId") .HasName("employee_id"); b.ToTable("employees"); b.HasData( new { EmployeeId = 1, City = "New York", Firstname = "John", Lastname = "Smith", Salary = 150f }, new { EmployeeId = 2, City = "New York", Firstname = "Ben", Lastname = "Johnson", Salary = 250f }, new { EmployeeId = 3, City = "New Orleans", Firstname = "Louis", Lastname = "Armstrong", Salary = 75f }, new { EmployeeId = 4, City = "London", Firstname = "John", Lastname = "Lennon", Salary = 300f }, new { EmployeeId = 5, City = "London", Firstname = "Peter", Lastname = "Gabriel", Salary = 150f }); }); modelBuilder.Entity("CodeFirst.Models.Models.Movies", b => { b.Property<int>("MovieId") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasColumnName("movie_id") .UseIdentityByDefaultColumn(); b.Property<int>("AgeRestriction") .HasColumnType("integer") .HasColumnName("age_restriction"); b.Property<float>("Price") .HasColumnType("real") .HasColumnName("price"); b.Property<string>("Title") .HasColumnType("text") .HasColumnName("title"); b.Property<int>("Year") .HasColumnType("integer") .HasColumnName("year"); b.HasKey("MovieId") .HasName("movies_pkey"); b.ToTable("movies"); b.HasData( new { MovieId = 1, AgeRestriction = 12, Price = 10f, Title = "Star Wars Episode IV: A New Hope", Year = 1979 }, new { MovieId = 2, AgeRestriction = 12, Price = 5.5f, Title = "Ghostbusters", Year = 1984 }, new { MovieId = 3, AgeRestriction = 15, Price = 8.5f, Title = "Terminator", Year = 1984 }, new { MovieId = 4, AgeRestriction = 17, Price = 5f, Title = "Taxi Driver", Year = 1976 }, new { MovieId = 5, AgeRestriction = 18, Price = 5f, Title = "Platoon", Year = 1986 }, new { MovieId = 6, AgeRestriction = 15, Price = 8.5f, Title = "Frantic", Year = 1988 }, new { MovieId = 7, AgeRestriction = 13, Price = 9.5f, Title = "Ronin", Year = 1998 }, new { MovieId = 8, AgeRestriction = 16, Price = 10.5f, Title = "Analyze This", Year = 1999 }, new { MovieId = 9, AgeRestriction = 16, Price = 8.5f, Title = "Leon: the Professional", Year = 1994 }, new { MovieId = 10, AgeRestriction = 13, Price = 8.5f, Title = "Mission Impossible", Year = 1996 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Rentals", b => { b.Property<int>("ClientId") .HasColumnType("integer") .HasColumnName("client_id"); b.Property<int>("CopyId") .HasColumnType("integer") .HasColumnName("copy_id"); b.Property<DateTime?>("DateOfRental") .HasColumnType("timestamp without time zone") .HasColumnName("date_of_rental"); b.Property<DateTime?>("DateOfReturn") .HasColumnType("timestamp without time zone") .HasColumnName("date_of_return"); b.HasKey("ClientId", "CopyId") .HasName("rentals_pkey"); b.HasIndex("CopyId"); b.ToTable("rentals"); b.HasData( new { ClientId = 1, CopyId = 1, DateOfRental = new DateTime(2005, 7, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 1, CopyId = 6, DateOfRental = new DateTime(2005, 7, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 3, DateOfRental = new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 5, DateOfRental = new DateTime(2005, 7, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 27, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 7, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 12, DateOfRental = new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 20, DateOfRental = new DateTime(2005, 7, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 3, DateOfRental = new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 23, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 7, DateOfRental = new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 4, CopyId = 13, DateOfRental = new DateTime(2005, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 5, CopyId = 11, DateOfRental = new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 1, DateOfRental = new DateTime(2005, 7, 6, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 7, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 7, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 19, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }); }); modelBuilder.Entity("CodeFirst.Models.Models.Starring", b => { b.Property<int>("ActorId") .HasColumnType("integer") .HasColumnName("actor_id"); b.Property<int>("MovieId") .HasColumnType("integer") .HasColumnName("movie_id"); b.HasKey("ActorId", "MovieId"); b.HasIndex("MovieId"); b.ToTable("starring"); b.HasData( new { ActorId = 2, MovieId = 1 }, new { ActorId = 3, MovieId = 1 }, new { ActorId = 4, MovieId = 1 }, new { ActorId = 5, MovieId = 1 }, new { ActorId = 6, MovieId = 1 }, new { ActorId = 7, MovieId = 1 }, new { ActorId = 8, MovieId = 1 }, new { ActorId = 1, MovieId = 3 }, new { ActorId = 9, MovieId = 3 }, new { ActorId = 10, MovieId = 3 }, new { ActorId = 11, MovieId = 2 }, new { ActorId = 12, MovieId = 2 }, new { ActorId = 13, MovieId = 2 }, new { ActorId = 14, MovieId = 4 }, new { ActorId = 15, MovieId = 4 }, new { ActorId = 16, MovieId = 4 }, new { ActorId = 17, MovieId = 4 }, new { ActorId = 18, MovieId = 5 }, new { ActorId = 19, MovieId = 5 }, new { ActorId = 20, MovieId = 5 }, new { ActorId = 21, MovieId = 6 }, new { ActorId = 22, MovieId = 6 }, new { ActorId = 14, MovieId = 7 }, new { ActorId = 23, MovieId = 7 }, new { ActorId = 14, MovieId = 8 }, new { ActorId = 24, MovieId = 8 }, new { ActorId = 25, MovieId = 8 }, new { ActorId = 23, MovieId = 9 }, new { ActorId = 27, MovieId = 9 }, new { ActorId = 23, MovieId = 10 }, new { ActorId = 28, MovieId = 10 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.HasOne("CodeFirst.Models.Models.Movies", "Movie") .WithMany("Copies") .HasForeignKey("MovieId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Movie"); }); modelBuilder.Entity("CodeFirst.Models.Models.Rentals", b => { b.HasOne("CodeFirst.Models.Models.Clients", "Client") .WithMany("Rentals") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CodeFirst.Models.Models.Copies", "Copy") .WithMany("Rentals") .HasForeignKey("CopyId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Client"); b.Navigation("Copy"); }); modelBuilder.Entity("CodeFirst.Models.Models.Starring", b => { b.HasOne("CodeFirst.Models.Models.Actors", "Actor") .WithMany("Starring") .HasForeignKey("ActorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CodeFirst.Models.Models.Movies", "Movie") .WithMany("Starring") .HasForeignKey("MovieId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Actor"); b.Navigation("Movie"); }); modelBuilder.Entity("CodeFirst.Models.Models.Actors", b => { b.Navigation("Starring"); }); modelBuilder.Entity("CodeFirst.Models.Models.Clients", b => { b.Navigation("Rentals"); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.Navigation("Rentals"); }); modelBuilder.Entity("CodeFirst.Models.Models.Movies", b => { b.Navigation("Copies"); b.Navigation("Starring"); }); #pragma warning restore 612, 618 } } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Migrations/PostgresDbContextModelSnapshot.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
6,650
```smalltalk using System; using Microsoft.EntityFrameworkCore.Migrations; namespace CodeFirst.DataAccess.Migrations.SqlServerDb; public partial class SqlServerInitialMigration : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "actors", columns: table => new { actor_id = table.Column<int>(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), first_name = table.Column<string>(type: "nvarchar(max)", nullable: true), last_name = table.Column<string>(type: "nvarchar(max)", nullable: true), birthday = table.Column<DateTime>(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("actor_pkey", x => x.actor_id); }); migrationBuilder.CreateTable( name: "clients", columns: table => new { client_id = table.Column<int>(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), first_name = table.Column<string>(type: "nvarchar(max)", nullable: true), last_name = table.Column<string>(type: "nvarchar(max)", nullable: true), birthday = table.Column<DateTime>(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("client_pkey", x => x.client_id); }); migrationBuilder.CreateTable( name: "employees", columns: table => new { employee_id = table.Column<int>(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), first_name = table.Column<string>(type: "nvarchar(max)", nullable: false), last_name = table.Column<string>(type: "nvarchar(max)", nullable: false), salary = table.Column<float>(type: "real", nullable: true), City = table.Column<string>(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("employee_id", x => x.employee_id); }); migrationBuilder.CreateTable( name: "movies", columns: table => new { movie_id = table.Column<int>(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), title = table.Column<string>(type: "nvarchar(max)", nullable: true), year = table.Column<int>(type: "int", nullable: false), age_restriction = table.Column<int>(type: "int", nullable: false), price = table.Column<float>(type: "real", nullable: false) }, constraints: table => { table.PrimaryKey("movies_pkey", x => x.movie_id); }); migrationBuilder.CreateTable( name: "copies", columns: table => new { copy_id = table.Column<int>(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), available = table.Column<bool>(type: "bit", nullable: false), movie_id = table.Column<int>(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("copies_pkey", x => x.copy_id); table.ForeignKey( name: "FK_copies_movies_movie_id", column: x => x.movie_id, principalTable: "movies", principalColumn: "movie_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "starring", columns: table => new { actor_id = table.Column<int>(type: "int", nullable: false), movie_id = table.Column<int>(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_starring", x => new { x.actor_id, x.movie_id }); table.ForeignKey( name: "FK_starring_actors_actor_id", column: x => x.actor_id, principalTable: "actors", principalColumn: "actor_id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_starring_movies_movie_id", column: x => x.movie_id, principalTable: "movies", principalColumn: "movie_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "rentals", columns: table => new { copy_id = table.Column<int>(type: "int", nullable: false), client_id = table.Column<int>(type: "int", nullable: false), date_of_rental = table.Column<DateTime>(type: "datetime2", nullable: true), date_of_return = table.Column<DateTime>(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("rentals_pkey", x => new { x.client_id, x.copy_id }); table.ForeignKey( name: "FK_rentals_clients_client_id", column: x => x.client_id, principalTable: "clients", principalColumn: "client_id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_rentals_copies_copy_id", column: x => x.copy_id, principalTable: "copies", principalColumn: "copy_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( table: "actors", columns: new[] { "actor_id", "birthday", "first_name", "last_name" }, values: new object[,] { { 1, new DateTime(1947, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), "Arnold", "Schwarzenegger" }, { 28, new DateTime(1962, 7, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), "Tom", "Cruise" }, { 27, new DateTime(1981, 6, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), "Natalie", "Portman" }, { 26, new DateTime(1958, 3, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), "Gary", "Oldman" }, { 24, new DateTime(1948, 3, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), "Billy", "Crystal" }, { 23, new DateTime(1948, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), "Jean", "Reno" }, { 22, new DateTime(1966, 6, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), "Emmanuelle", "Seigner" }, { 21, new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), "Harrison", "Ford" }, { 20, new DateTime(1965, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), "Charlie", "Sheen" }, { 19, new DateTime(1955, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), "Willem", "Dafoe" }, { 18, new DateTime(1949, 5, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), "Tom", "Berenger" }, { 17, new DateTime(1950, 2, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cybill", "Shepherd" }, { 16, new DateTime(1939, 5, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), "Harvey", "Keitel" }, { 15, new DateTime(1962, 11, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), "Jodie", "Foster" }, { 25, new DateTime(1963, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), "Lisa", "Kudrow" }, { 13, new DateTime(1949, 10, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), "Sigourney", "Weaver" }, { 12, new DateTime(1952, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Dan", "Aykroyd" }, { 11, new DateTime(1950, 9, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), "Bill", "Murray" }, { 10, new DateTime(1956, 9, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), "Linda", "Hamilton" }, { 9, new DateTime(1956, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), "Michael", "Biehn" }, { 8, new DateTime(1935, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Peter", "Mayhew" }, { 7, new DateTime(1944, 5, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), "David", "Prowse" }, { 6, new DateTime(1913, 5, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), "Peter", "Cushing" }, { 5, new DateTime(1914, 4, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), "Alec", "Guiness" }, { 4, new DateTime(1956, 10, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), "Carrie", "Fisher" }, { 3, new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), "Harrison", "Ford" }, { 2, new DateTime(1946, 2, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), "Anthony", "Daniels" }, { 14, new DateTime(1943, 8, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), "Robert", "De Niro" } }); migrationBuilder.InsertData( table: "clients", columns: new[] { "client_id", "birthday", "first_name", "last_name" }, values: new object[,] { { 6, new DateTime(1965, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), "Rick", "Sanchez" }, { 5, new DateTime(2012, 5, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), "Lisa", "Simpson" }, { 4, new DateTime(1977, 1, 23, 0, 0, 0, 0, DateTimeKind.Unspecified), "Bob", "Belcher" }, { 2, new DateTime(2011, 9, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), "Brian", "Griffin" }, { 1, new DateTime(1954, 4, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), "Hank", "Hill" }, { 3, new DateTime(1989, 3, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), "Gary", "Goodspeed" } }); migrationBuilder.InsertData( table: "employees", columns: new[] { "employee_id", "City", "first_name", "last_name", "salary" }, values: new object[,] { { 1, "New York", "John", "Smith", 150f }, { 2, "New York", "Ben", "Johnson", 250f }, { 3, "New Orleans", "Louis", "Armstrong", 75f }, { 4, "London", "John", "Lennon", 300f }, { 5, "London", "Peter", "Gabriel", 150f } }); migrationBuilder.InsertData( table: "movies", columns: new[] { "movie_id", "age_restriction", "price", "title", "year" }, values: new object[,] { { 8, 16, 10.5f, "Analyze This", 1999 }, { 7, 13, 9.5f, "Ronin", 1998 }, { 6, 15, 8.5f, "Frantic", 1988 } }); migrationBuilder.InsertData( table: "movies", columns: new[] { "movie_id", "age_restriction", "price", "title", "year" }, values: new object[,] { { 5, 18, 5f, "Platoon", 1986 }, { 1, 12, 10f, "Star Wars Episode IV: A New Hope", 1979 }, { 3, 15, 8.5f, "Terminator", 1984 }, { 2, 12, 5.5f, "Ghostbusters", 1984 }, { 9, 16, 8.5f, "Leon: the Professional", 1994 }, { 4, 17, 5f, "Taxi Driver", 1976 }, { 10, 13, 8.5f, "Mission Impossible", 1996 } }); migrationBuilder.InsertData( table: "copies", columns: new[] { "copy_id", "available", "movie_id" }, values: new object[,] { { 1, true, 1 }, { 11, true, 6 }, { 8, false, 5 }, { 12, true, 7 }, { 13, true, 7 }, { 7, true, 4 }, { 14, false, 8 }, { 6, true, 3 }, { 10, false, 6 }, { 4, true, 3 }, { 5, false, 3 }, { 17, false, 10 }, { 2, false, 1 }, { 20, true, 10 }, { 19, true, 10 }, { 18, true, 10 }, { 15, true, 9 }, { 9, true, 6 }, { 3, true, 2 }, { 16, true, 10 } }); migrationBuilder.InsertData( table: "starring", columns: new[] { "actor_id", "movie_id" }, values: new object[,] { { 23, 7 }, { 14, 8 }, { 14, 7 }, { 27, 9 }, { 23, 9 }, { 22, 6 }, { 21, 6 }, { 24, 8 }, { 25, 8 }, { 18, 5 }, { 19, 5 }, { 2, 1 }, { 3, 1 }, { 4, 1 }, { 5, 1 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 11, 2 }, { 20, 5 }, { 12, 2 }, { 1, 3 } }); migrationBuilder.InsertData( table: "starring", columns: new[] { "actor_id", "movie_id" }, values: new object[,] { { 9, 3 }, { 10, 3 }, { 14, 4 }, { 15, 4 }, { 16, 4 }, { 17, 4 }, { 23, 10 }, { 13, 2 }, { 28, 10 } }); migrationBuilder.InsertData( table: "rentals", columns: new[] { "client_id", "copy_id", "date_of_rental", "date_of_return" }, values: new object[,] { { 1, 1, new DateTime(2005, 7, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 6, 1, new DateTime(2005, 7, 6, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 7, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 2, 3, new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 3, 3, new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 23, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 2, 5, new DateTime(2005, 7, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 27, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 1, 6, new DateTime(2005, 7, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 2, 7, new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 3, 7, new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 6, 7, new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 5, 11, new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 3, 12, new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 4, 13, new DateTime(2005, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 6, 19, new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, { 3, 20, new DateTime(2005, 7, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2005, 7, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) } }); migrationBuilder.CreateIndex( name: "IX_copies_movie_id", table: "copies", column: "movie_id"); migrationBuilder.CreateIndex( name: "IX_rentals_copy_id", table: "rentals", column: "copy_id"); migrationBuilder.CreateIndex( name: "IX_starring_movie_id", table: "starring", column: "movie_id"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "employees"); migrationBuilder.DropTable( name: "rentals"); migrationBuilder.DropTable( name: "starring"); migrationBuilder.DropTable( name: "clients"); migrationBuilder.DropTable( name: "copies"); migrationBuilder.DropTable( name: "actors"); migrationBuilder.DropTable( name: "movies"); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Migrations/SqlServerDb/20220124205405_SqlServerInitialMigration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
4,775
```smalltalk // <auto-generated /> using System; using CodeFirst.DataAccess.Context; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace CodeFirst.DataAccess.Migrations.SqlServerDb { [DbContext(typeof(SqlServerDbContext))] partial class SqlServerDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .UseIdentityColumns() .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("ProductVersion", "5.0.1"); modelBuilder.Entity("CodeFirst.Models.Models.Actors", b => { b.Property<int>("ActorId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("actor_id") .UseIdentityColumn(); b.Property<DateTime?>("Birthday") .HasColumnType("datetime2") .HasColumnName("birthday"); b.Property<string>("Firstname") .HasColumnType("nvarchar(max)") .HasColumnName("first_name"); b.Property<string>("Lastname") .HasColumnType("nvarchar(max)") .HasColumnName("last_name"); b.HasKey("ActorId") .HasName("actor_pkey"); b.ToTable("actors"); b.HasData( new { ActorId = 1, Birthday = new DateTime(1947, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Arnold", Lastname = "Schwarzenegger" }, new { ActorId = 2, Birthday = new DateTime(1946, 2, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Anthony", Lastname = "Daniels" }, new { ActorId = 3, Birthday = new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harrison", Lastname = "Ford" }, new { ActorId = 4, Birthday = new DateTime(1956, 10, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Carrie", Lastname = "Fisher" }, new { ActorId = 5, Birthday = new DateTime(1914, 4, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Alec", Lastname = "Guiness" }, new { ActorId = 6, Birthday = new DateTime(1913, 5, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Peter", Lastname = "Cushing" }, new { ActorId = 7, Birthday = new DateTime(1944, 5, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "David", Lastname = "Prowse" }, new { ActorId = 8, Birthday = new DateTime(1935, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Peter", Lastname = "Mayhew" }, new { ActorId = 9, Birthday = new DateTime(1956, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Michael", Lastname = "Biehn" }, new { ActorId = 10, Birthday = new DateTime(1956, 9, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Linda", Lastname = "Hamilton" }, new { ActorId = 11, Birthday = new DateTime(1950, 9, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Bill", Lastname = "Murray" }, new { ActorId = 12, Birthday = new DateTime(1952, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Dan", Lastname = "Aykroyd" }, new { ActorId = 13, Birthday = new DateTime(1949, 10, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Sigourney", Lastname = "Weaver" }, new { ActorId = 14, Birthday = new DateTime(1943, 8, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Robert", Lastname = "De Niro" }, new { ActorId = 15, Birthday = new DateTime(1962, 11, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Jodie", Lastname = "Foster" }, new { ActorId = 16, Birthday = new DateTime(1939, 5, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harvey", Lastname = "Keitel" }, new { ActorId = 17, Birthday = new DateTime(1950, 2, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Cybill", Lastname = "Shepherd" }, new { ActorId = 18, Birthday = new DateTime(1949, 5, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Tom", Lastname = "Berenger" }, new { ActorId = 19, Birthday = new DateTime(1955, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Willem", Lastname = "Dafoe" }, new { ActorId = 20, Birthday = new DateTime(1965, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Charlie", Lastname = "Sheen" }, new { ActorId = 21, Birthday = new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harrison", Lastname = "Ford" }, new { ActorId = 22, Birthday = new DateTime(1966, 6, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Emmanuelle", Lastname = "Seigner" }, new { ActorId = 23, Birthday = new DateTime(1948, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Jean", Lastname = "Reno" }, new { ActorId = 24, Birthday = new DateTime(1948, 3, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Billy", Lastname = "Crystal" }, new { ActorId = 25, Birthday = new DateTime(1963, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Lisa", Lastname = "Kudrow" }, new { ActorId = 26, Birthday = new DateTime(1958, 3, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Gary", Lastname = "Oldman" }, new { ActorId = 27, Birthday = new DateTime(1981, 6, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Natalie", Lastname = "Portman" }, new { ActorId = 28, Birthday = new DateTime(1962, 7, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Tom", Lastname = "Cruise" }); }); modelBuilder.Entity("CodeFirst.Models.Models.Clients", b => { b.Property<int>("ClientId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("client_id") .UseIdentityColumn(); b.Property<DateTime?>("Birthday") .HasColumnType("datetime2") .HasColumnName("birthday"); b.Property<string>("Firstname") .HasColumnType("nvarchar(max)") .HasColumnName("first_name"); b.Property<string>("Lastname") .HasColumnType("nvarchar(max)") .HasColumnName("last_name"); b.HasKey("ClientId") .HasName("client_pkey"); b.ToTable("clients"); b.HasData( new { ClientId = 1, Birthday = new DateTime(1954, 4, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Hank", Lastname = "Hill" }, new { ClientId = 2, Birthday = new DateTime(2011, 9, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Brian", Lastname = "Griffin" }, new { ClientId = 3, Birthday = new DateTime(1989, 3, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Gary", Lastname = "Goodspeed" }, new { ClientId = 4, Birthday = new DateTime(1977, 1, 23, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Bob", Lastname = "Belcher" }, new { ClientId = 5, Birthday = new DateTime(2012, 5, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Lisa", Lastname = "Simpson" }, new { ClientId = 6, Birthday = new DateTime(1965, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Rick", Lastname = "Sanchez" }); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.Property<int>("CopyId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("copy_id") .UseIdentityColumn(); b.Property<bool>("Available") .HasColumnType("bit") .HasColumnName("available"); b.Property<int>("MovieId") .HasColumnType("int") .HasColumnName("movie_id"); b.HasKey("CopyId") .HasName("copies_pkey"); b.HasIndex("MovieId"); b.ToTable("copies"); b.HasData( new { CopyId = 1, Available = true, MovieId = 1 }, new { CopyId = 2, Available = false, MovieId = 1 }, new { CopyId = 3, Available = true, MovieId = 2 }, new { CopyId = 4, Available = true, MovieId = 3 }, new { CopyId = 5, Available = false, MovieId = 3 }, new { CopyId = 6, Available = true, MovieId = 3 }, new { CopyId = 7, Available = true, MovieId = 4 }, new { CopyId = 8, Available = false, MovieId = 5 }, new { CopyId = 9, Available = true, MovieId = 6 }, new { CopyId = 10, Available = false, MovieId = 6 }, new { CopyId = 11, Available = true, MovieId = 6 }, new { CopyId = 12, Available = true, MovieId = 7 }, new { CopyId = 13, Available = true, MovieId = 7 }, new { CopyId = 14, Available = false, MovieId = 8 }, new { CopyId = 15, Available = true, MovieId = 9 }, new { CopyId = 16, Available = true, MovieId = 10 }, new { CopyId = 17, Available = false, MovieId = 10 }, new { CopyId = 18, Available = true, MovieId = 10 }, new { CopyId = 19, Available = true, MovieId = 10 }, new { CopyId = 20, Available = true, MovieId = 10 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Employees", b => { b.Property<int>("EmployeeId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("employee_id") .UseIdentityColumn(); b.Property<string>("City") .HasColumnType("nvarchar(max)"); b.Property<string>("Firstname") .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("first_name"); b.Property<string>("Lastname") .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("last_name"); b.Property<float?>("Salary") .HasColumnType("real") .HasColumnName("salary"); b.HasKey("EmployeeId") .HasName("employee_id"); b.ToTable("employees"); b.HasData( new { EmployeeId = 1, City = "New York", Firstname = "John", Lastname = "Smith", Salary = 150f }, new { EmployeeId = 2, City = "New York", Firstname = "Ben", Lastname = "Johnson", Salary = 250f }, new { EmployeeId = 3, City = "New Orleans", Firstname = "Louis", Lastname = "Armstrong", Salary = 75f }, new { EmployeeId = 4, City = "London", Firstname = "John", Lastname = "Lennon", Salary = 300f }, new { EmployeeId = 5, City = "London", Firstname = "Peter", Lastname = "Gabriel", Salary = 150f }); }); modelBuilder.Entity("CodeFirst.Models.Models.Movies", b => { b.Property<int>("MovieId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("movie_id") .UseIdentityColumn(); b.Property<int>("AgeRestriction") .HasColumnType("int") .HasColumnName("age_restriction"); b.Property<float>("Price") .HasColumnType("real") .HasColumnName("price"); b.Property<string>("Title") .HasColumnType("nvarchar(max)") .HasColumnName("title"); b.Property<int>("Year") .HasColumnType("int") .HasColumnName("year"); b.HasKey("MovieId") .HasName("movies_pkey"); b.ToTable("movies"); b.HasData( new { MovieId = 1, AgeRestriction = 12, Price = 10f, Title = "Star Wars Episode IV: A New Hope", Year = 1979 }, new { MovieId = 2, AgeRestriction = 12, Price = 5.5f, Title = "Ghostbusters", Year = 1984 }, new { MovieId = 3, AgeRestriction = 15, Price = 8.5f, Title = "Terminator", Year = 1984 }, new { MovieId = 4, AgeRestriction = 17, Price = 5f, Title = "Taxi Driver", Year = 1976 }, new { MovieId = 5, AgeRestriction = 18, Price = 5f, Title = "Platoon", Year = 1986 }, new { MovieId = 6, AgeRestriction = 15, Price = 8.5f, Title = "Frantic", Year = 1988 }, new { MovieId = 7, AgeRestriction = 13, Price = 9.5f, Title = "Ronin", Year = 1998 }, new { MovieId = 8, AgeRestriction = 16, Price = 10.5f, Title = "Analyze This", Year = 1999 }, new { MovieId = 9, AgeRestriction = 16, Price = 8.5f, Title = "Leon: the Professional", Year = 1994 }, new { MovieId = 10, AgeRestriction = 13, Price = 8.5f, Title = "Mission Impossible", Year = 1996 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Rentals", b => { b.Property<int>("ClientId") .HasColumnType("int") .HasColumnName("client_id"); b.Property<int>("CopyId") .HasColumnType("int") .HasColumnName("copy_id"); b.Property<DateTime?>("DateOfRental") .HasColumnType("datetime2") .HasColumnName("date_of_rental"); b.Property<DateTime?>("DateOfReturn") .HasColumnType("datetime2") .HasColumnName("date_of_return"); b.HasKey("ClientId", "CopyId") .HasName("rentals_pkey"); b.HasIndex("CopyId"); b.ToTable("rentals"); b.HasData( new { ClientId = 1, CopyId = 1, DateOfRental = new DateTime(2005, 7, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 1, CopyId = 6, DateOfRental = new DateTime(2005, 7, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 3, DateOfRental = new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 5, DateOfRental = new DateTime(2005, 7, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 27, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 7, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 12, DateOfRental = new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 20, DateOfRental = new DateTime(2005, 7, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 3, DateOfRental = new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 23, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 7, DateOfRental = new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 4, CopyId = 13, DateOfRental = new DateTime(2005, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 5, CopyId = 11, DateOfRental = new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 1, DateOfRental = new DateTime(2005, 7, 6, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 7, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 7, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 19, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }); }); modelBuilder.Entity("CodeFirst.Models.Models.Starring", b => { b.Property<int>("ActorId") .HasColumnType("int") .HasColumnName("actor_id"); b.Property<int>("MovieId") .HasColumnType("int") .HasColumnName("movie_id"); b.HasKey("ActorId", "MovieId"); b.HasIndex("MovieId"); b.ToTable("starring"); b.HasData( new { ActorId = 2, MovieId = 1 }, new { ActorId = 3, MovieId = 1 }, new { ActorId = 4, MovieId = 1 }, new { ActorId = 5, MovieId = 1 }, new { ActorId = 6, MovieId = 1 }, new { ActorId = 7, MovieId = 1 }, new { ActorId = 8, MovieId = 1 }, new { ActorId = 1, MovieId = 3 }, new { ActorId = 9, MovieId = 3 }, new { ActorId = 10, MovieId = 3 }, new { ActorId = 11, MovieId = 2 }, new { ActorId = 12, MovieId = 2 }, new { ActorId = 13, MovieId = 2 }, new { ActorId = 14, MovieId = 4 }, new { ActorId = 15, MovieId = 4 }, new { ActorId = 16, MovieId = 4 }, new { ActorId = 17, MovieId = 4 }, new { ActorId = 18, MovieId = 5 }, new { ActorId = 19, MovieId = 5 }, new { ActorId = 20, MovieId = 5 }, new { ActorId = 21, MovieId = 6 }, new { ActorId = 22, MovieId = 6 }, new { ActorId = 14, MovieId = 7 }, new { ActorId = 23, MovieId = 7 }, new { ActorId = 14, MovieId = 8 }, new { ActorId = 24, MovieId = 8 }, new { ActorId = 25, MovieId = 8 }, new { ActorId = 23, MovieId = 9 }, new { ActorId = 27, MovieId = 9 }, new { ActorId = 23, MovieId = 10 }, new { ActorId = 28, MovieId = 10 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.HasOne("CodeFirst.Models.Models.Movies", "Movie") .WithMany("Copies") .HasForeignKey("MovieId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Movie"); }); modelBuilder.Entity("CodeFirst.Models.Models.Rentals", b => { b.HasOne("CodeFirst.Models.Models.Clients", "Client") .WithMany("Rentals") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CodeFirst.Models.Models.Copies", "Copy") .WithMany("Rentals") .HasForeignKey("CopyId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Client"); b.Navigation("Copy"); }); modelBuilder.Entity("CodeFirst.Models.Models.Starring", b => { b.HasOne("CodeFirst.Models.Models.Actors", "Actor") .WithMany("Starring") .HasForeignKey("ActorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CodeFirst.Models.Models.Movies", "Movie") .WithMany("Starring") .HasForeignKey("MovieId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Actor"); b.Navigation("Movie"); }); modelBuilder.Entity("CodeFirst.Models.Models.Actors", b => { b.Navigation("Starring"); }); modelBuilder.Entity("CodeFirst.Models.Models.Clients", b => { b.Navigation("Rentals"); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.Navigation("Rentals"); }); modelBuilder.Entity("CodeFirst.Models.Models.Movies", b => { b.Navigation("Copies"); b.Navigation("Starring"); }); #pragma warning restore 612, 618 } } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Migrations/SqlServerDb/SqlServerDbContextModelSnapshot.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
6,639
```smalltalk using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Threading.Tasks; namespace CodeFirst.DataAccess.Interfaces; public interface IRepository<T> { Task AddAsync(T entity); void Update(T entity); void Delete(T entity); void Delete(Expression<Func<T, bool>> where); Task<T> GetByIdAsync(int id); Task<T> GetSingleAsync(Expression<Func<T, bool>> where); Task<IEnumerable<T>> GetAllAsync(); Task<IEnumerable<T>> GetManyAsync(Expression<Func<T, bool>> where); Task<bool> SaveChangesAsync(); } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Interfaces/IRepository.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
118
```smalltalk using System; using CodeFirst.DataAccess.Context; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; namespace CodeFirst.DataAccess.Factories; public class SqlServerDbContextFactory : IDesignTimeDbContextFactory<SqlServerDbContext> { public SqlServerDbContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder<SqlServerDbContext>(); var connectionString = Environment.GetEnvironmentVariable("SQLSERVER_MOVIES_LOCAL_CONNSTR"); optionsBuilder.UseSqlServer(connectionString ?? throw new NullReferenceException( $"Connection string is not got from environment {nameof(connectionString)}")); return new SqlServerDbContext(optionsBuilder.Options); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Factories/SqlServerDbContextFactory.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
128
```smalltalk using System; using CodeFirst.DataAccess.Context; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; namespace CodeFirst.DataAccess.Factories; public class PostgresDbContextFactory : IDesignTimeDbContextFactory<PostgresDbContext> { public PostgresDbContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder<PostgresDbContext>(); var connectionString = Environment.GetEnvironmentVariable("POSTGRES_MOVIES_LOCAL_CONNSTR"); optionsBuilder.UseNpgsql(connectionString ?? throw new NullReferenceException( $"Connection string is not got from environment {nameof(connectionString)}")); return new PostgresDbContext(optionsBuilder.Options); } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Factories/PostgresDbContextFactory.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
129
```xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net6.0</TargetFramework> </PropertyGroup> <ItemGroup> <ProjectReference Include="..\..\src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore6\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore6.csproj" /> <ProjectReference Include="..\CodeFirst.DataAccess\CodeFirst.DataAccess.csproj" /> </ItemGroup> </Project> ```
/content/code_sandbox/src-examples/CodeFirst.ConsoleApp/CodeFirst.ConsoleApp.csproj
xml
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
107
```smalltalk using System; using System.Diagnostics; using System.Linq; using System.Linq.Dynamic.Core; using System.Threading.Tasks; using CodeFirst.DataAccess.Factories; using CodeFirst.DataAccess.Repositories; using Microsoft.EntityFrameworkCore; namespace CodeFirst.ConsoleApp; public static class Program { private static async Task Main() { var sqlFactory = new SqlServerDbContextFactory(); await using var context = sqlFactory.CreateDbContext(Array.Empty<string>()); var stopwatch = ValueStopwatch.StartNew(); var query1 = context.Movies.Include(x => x.Copies).Where("Title.Contains(\"e\")").ToDynamicList(); Console.WriteLine($"Elapsed time: {stopwatch.GetElapsedTime().TotalMilliseconds}ms"); query1.ToList().ToList().ForEach(Console.WriteLine); Console.WriteLine(new string('-', 80)); stopwatch = ValueStopwatch.StartNew(); var query2 = context.Movies.Include(x => x.Copies).Where("Title.Contains(\"e\")").ToDynamicList(); Console.WriteLine($"Elapsed time: {stopwatch.GetElapsedTime().TotalMilliseconds}ms"); query2.ToList().ToList().ForEach(Console.WriteLine); //var sqlServerRepo = new MoviesRepository(sqlFactory.CreateDbContext(Array.Empty<string>())); //var movies = await sqlServerRepo.GetAllAsync(); //movies.ToList().ForEach(Console.WriteLine); //var getById = await sqlServerRepo.GetByIdAsync(3); //Console.WriteLine(getById.Title); //var postFactory = new PostgresDbContextFactory(); //var postgresRepo = new MoviesRepository(postFactory.CreateDbContext(Array.Empty<string>())); //movies = await postgresRepo.GetAllAsync(); //movies.ToList().ForEach(Console.WriteLine); //getById = await postgresRepo.GetByIdAsync(3); //Console.WriteLine(getById.Title); } /// <summary> /// Copied from path_to_url /// </summary> internal readonly struct ValueStopwatch { #if !NET7_0_OR_GREATER private static readonly double TimestampToTicks = TimeSpan.TicksPerSecond / (double)Stopwatch.Frequency; #endif private readonly long _startTimestamp; public bool IsActive => _startTimestamp != 0; private ValueStopwatch(long startTimestamp) { _startTimestamp = startTimestamp; } public static ValueStopwatch StartNew() => new(Stopwatch.GetTimestamp()); public TimeSpan GetElapsedTime() { // Start timestamp can't be zero in an initialized ValueStopwatch. It would have to be literally the first thing executed when the machine boots to be 0. // So it being 0 is a clear indication of default(ValueStopwatch) if (!IsActive) { throw new InvalidOperationException("An uninitialized, or 'default', ValueStopwatch cannot be used to get elapsed time."); } var end = Stopwatch.GetTimestamp(); #if !NET7_0_OR_GREATER var timestampDelta = end - _startTimestamp; var ticks = (long)(TimestampToTicks * timestampDelta); return new TimeSpan(ticks); #else return Stopwatch.GetElapsedTime(_startTimestamp, end); #endif } } } ```
/content/code_sandbox/src-examples/CodeFirst.ConsoleApp/Program.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
642
```xml <Project> <PropertyGroup> <LangVersion>12</LangVersion> <Nullable>enable</Nullable> <!-- path_to_url --> <CollectCoverage>true</CollectCoverage> <ExcludeByAttribute>GeneratedCodeAttribute</ExcludeByAttribute> <CoverletOutputFormat>opencover</CoverletOutputFormat> </PropertyGroup> </Project> ```
/content/code_sandbox/test/Directory.Build.props
xml
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
79
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void LongCount() { //Arrange IQueryable testListFull = User.GenerateSampleModels(100).AsQueryable(); IQueryable testListOne = User.GenerateSampleModels(1).AsQueryable(); IQueryable testListNone = User.GenerateSampleModels(0).AsQueryable(); //Act var resultFull = testListFull.LongCount(); var resultOne = testListOne.LongCount(); var resultNone = testListNone.LongCount(); //Assert Assert.Equal(100, resultFull); Assert.Equal(1, resultOne); Assert.Equal(0, resultNone); } [Fact] public void LongCount_Predicate() { //Arrange var queryable = User.GenerateSampleModels(100).AsQueryable(); //Act long expected = queryable.LongCount(u => u.Income > 50); long result = queryable.LongCount("Income > 50"); //Assert Assert.Equal(expected, result); } [Fact] public void LongCount_Predicate_WithArgs() { const int value = 50; //Arrange var queryable = User.GenerateSampleModels(100).AsQueryable(); //Act long expected = queryable.LongCount(u => u.Income > value); long result = queryable.LongCount("Income > @0", value); //Assert Assert.Equal(expected, result); } [Fact] public void LongCount_Dynamic_Select() { // Arrange IQueryable<User> queryable = User.GenerateSampleModels(1).AsQueryable(); // Act var expected = queryable.Select(x => x.Roles.LongCount()).ToArray(); var result = queryable.Select("Roles.LongCount()").ToDynamicArray<long>(); // Assert Assert.Equal(expected, result); } [Fact] public void LongCount_Dynamic_Where() { const string search = "e"; // Arrange var testList = User.GenerateSampleModels(10); var queryable = testList.AsQueryable(); // Act var expected = queryable.Where(u => u.Roles.LongCount(r => r.Name.Contains(search)) > 0).ToArray(); var result = queryable.Where("Roles.LongCount(Name.Contains(@0)) > 0", search).ToArray(); Assert.Equal(expected, result); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.LongCount.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
542
```smalltalk using System.Collections.Generic; using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Entities; using FluentAssertions; using NFluent; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void OfType_WithType() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "e" }, new Boss { Name = "e" } }.AsQueryable(); // Act var oftype = qry.OfType<Worker>().ToArray(); var oftypeDynamic = qry.OfType(typeof(Worker)).ToDynamicArray(); // Assert Check.That(oftypeDynamic.Length).Equals(oftype.Length); } [Fact] public void OfType_WithString() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "e" }, new Boss { Name = "e" } }.AsQueryable(); // Act var oftype = qry.OfType<Worker>().ToArray(); var oftypeDynamic = qry.OfType(typeof(Worker).FullName).ToDynamicArray(); // Assert Check.That(oftypeDynamic.Length).Equals(oftype.Length); } [Fact] public void OfType_Dynamic_WithFullName() { // Assign var qry = new[] { new CompanyWithBaseEmployees { Employees = new BaseEmployee[] { new Worker { Name = "e" }, new Boss { Name = "e" } } } }.AsQueryable(); // Act var oftype = qry.Select(c => c.Employees.OfType<Worker>().Where(e => e.Name == "e")).ToArray(); var oftypeDynamic = qry.Select("Employees.OfType(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\").Where(Name == \"e\")").ToDynamicArray(); // Assert Check.That(oftypeDynamic.Length).Equals(oftype.Length); } [Theory] [InlineData(true)] [InlineData(false)] public void OfType_Dynamic_WithFullName_UseParameterizedNamesInDynamicQuery(bool useParameterizedNamesInDynamicQuery) { // Assign var qry = new[] { new CompanyWithBaseEmployees { Employees = new BaseEmployee[] { new Worker { Name = "e" }, new Boss { Name = "e" } } } }.AsQueryable(); var parsingConfig = new ParsingConfig { UseParameterizedNamesInDynamicQuery = useParameterizedNamesInDynamicQuery }; // Act var oftype = qry.Select(c => c.Employees.OfType<Worker>().Where(e => e.Name == "e")).ToArray(); var oftypeDynamic = qry.Select(parsingConfig, "Employees.OfType(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\").Where(Name == \"e\")").ToDynamicArray(); // Assert Check.That(oftypeDynamic.Length).Equals(oftype.Length); } internal class Base { } internal class DerivedA : Base { } internal class DerivedB : Base { } internal class Parent { public IEnumerable<Base> Children { get; set; } } [Theory] [InlineData(true)] [InlineData(false)] public void OfType_Dynamic_WithFullName_AllowNewToEvaluateAnyType(bool allowNewToEvaluateAnyType) { // Arrange var config = new ParsingConfig { AllowNewToEvaluateAnyType = allowNewToEvaluateAnyType }; var queryable = new Parent[] { new() { Children = new Base[] { new DerivedA(), new DerivedB() } } }.AsQueryable(); var fullType = typeof(DerivedA).FullName; // Act var query = queryable.Select(config, $"Children.OfType(\"{fullType}\")"); var result = query.ToDynamicArray(); // Assert result.Should().HaveCount(1); } [Fact] public void OfType_Dynamic_WithType() { // Assign var qry = new[] { new CompanyWithBaseEmployees { Employees = new BaseEmployee[] { new Worker { Name = "e" }, new Boss { Name = "e" } } } }.AsQueryable(); // Act var oftype = qry.Select(c => c.Employees.OfType<Worker>().Where(e => e.Name == "e")).ToArray(); var oftypeDynamic = qry.Select("Employees.OfType(@0).Where(Name == \"e\")", typeof(Worker)).ToDynamicArray(); // Assert Check.That(oftypeDynamic.Length).Equals(oftype.Length); } [Fact] public void Is_Dynamic_ActingOnIt() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Boss { Name = "b" } }.AsQueryable(); // Act int countOfType = qry.Count(c => c is Worker); int countOfTypeDynamic = qry.Count("is(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\")"); // Assert Check.That(countOfTypeDynamic).Equals(countOfType); } [Fact] public void Is_Dynamic_ActingOnIt_WithSimpleName() { // Assign var config = new ParsingConfig { ResolveTypesBySimpleName = true }; var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Boss { Name = "b" } }.AsQueryable(); // Act int countOfType = qry.Count(c => c is Worker); int countOfTypeDynamic = qry.Count(config, "is(\"Worker\")"); // Assert Check.That(countOfTypeDynamic).Equals(countOfType); } [Fact] public void Is_Dynamic_ActingOnIt_WithType() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Boss { Name = "b" } }.AsQueryable(); // Act int countOfType = qry.Count(c => c is Worker); int countOfTypeDynamic = qry.Count("is(@0)", typeof(Worker)); // Assert Check.That(countOfTypeDynamic).Equals(countOfType); } [Fact] public void As_Dynamic_ActingOnIt() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Boss { Name = "b" } }.AsQueryable(); // Act int countAsDynamic = qry.Count("As(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\") != null"); // Assert Check.That(countAsDynamic).Equals(1); } [Fact] public void As_Dynamic_ActingOnIt_WithType() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Boss { Name = "b" } }.AsQueryable(); // Act int countAsDynamic = qry.Count("As(@0) != null", typeof(Worker)); // Assert Check.That(countAsDynamic).Equals(1); } [Fact] public void As_Dynamic_ActingOnProperty() { // Assign var qry = new[] { new Department { Employee = new Worker { Name = "1" } }, new Department { Employee = new Boss { Name = "b" } } }.AsQueryable(); // Act int countAsDynamic = qry.Count("As(Employee, \"System.Linq.Dynamic.Core.Tests.Entities.Worker\") != null"); // Assert countAsDynamic.Should().Be(1); } [Fact] public void As_Dynamic_ActingOnProperty_NullableInt() { // Assign var qry = new[] { new { Value = (int?) null }, new { Value = (int?) 2 }, new { Value = (int?) 42 } }.AsQueryable(); // Act int count = qry.Count(x => x.Value as int? != null); int? countAsDynamic = qry.Count("As(Value, \"int?\") != null"); // Assert countAsDynamic.Should().Be(count); } public enum TestEnum { None = 0, X = 1 } [Fact] public void As_Dynamic_ActingOnProperty_NullableEnum() { // Assign var nullableEnumType = $"{typeof(TestEnum).FullName}?"; var qry = new[] { new { Value = TestEnum.X } }.AsQueryable(); // Act int countAsDynamic = qry.Count($"As(Value, \"{nullableEnumType}\") != null"); // Assert countAsDynamic.Should().Be(1); } [Fact] public void As_Dynamic_ActingOnProperty_NullableClass() { // Assign var nullableClassType = $"{typeof(Worker).FullName}?"; var qry = new[] { new Department { NullableEmployee = new Worker { Name = "1" } }, new Department { NullableEmployee = new Boss { Name = "b" } } }.AsQueryable(); // Act int countAsDynamic = qry.Count($"As(NullableEmployee, \"{nullableClassType}\") != null"); // Assert countAsDynamic.Should().Be(1); } [Fact] public void As_Dynamic_ActingOnProperty_WithType() { // Assign var qry = new[] { new Department { Employee = new Worker { Name = "1" } }, new Department { Employee = new Boss { Name = "b" } } }.AsQueryable(); // Act int countAsDynamic = qry.Count("As(Employee, @0) != null", typeof(Worker)); // Assert countAsDynamic.Should().Be(1); } public class AS_A { } public class AS_B : AS_A { public string MyProperty { get; set; } } [Fact] [Trait("bug", "452")] public void As_UnaryExpression() { // Arrange var a = new AS_A(); var b = new AS_B { MyProperty = "x" }; var lst = new List<AS_A> { a, b }; // Act var result = lst.AsQueryable().Where($"np(as(\"{typeof(AS_B).FullName}\").MyProperty) = \"x\""); // Assert result.ToDynamicArray().Should().HaveCount(1).And.Contain(b); } [Fact] public void CastToType_WithType() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Worker { Name = "2" } }.AsQueryable(); // Act var cast = qry.Cast<Worker>().ToArray(); var castDynamic = qry.Cast(typeof(Worker)).ToDynamicArray(); // Assert Check.That(castDynamic.Length).Equals(cast.Length); } [Fact] public void CastToType_WithString() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Worker { Name = "2" } }.AsQueryable(); // Act var cast = qry.Cast<Worker>().ToArray(); var castDynamic = qry.Cast(typeof(Worker).FullName).ToDynamicArray(); // Assert Check.That(castDynamic.Length).Equals(cast.Length); } [Fact] public void CastToType_Dynamic() { // Assign var qry = new[] { new CompanyWithBaseEmployees { Employees = new BaseEmployee[] { new Worker { Name = "e" } } } }.AsQueryable(); // Act var cast = qry.Select(c => c.Employees.Cast<Worker>().Where(e => e.Name == "e")).ToArray(); var castDynamic = qry.Select("Employees.Cast(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\").Where(Name == \"e\")").ToDynamicArray(); // Assert Check.That(cast.Length).Equals(castDynamic.Length); } [Fact] public void CastToType_Dynamic_WithType() { // Assign var qry = new[] { new CompanyWithBaseEmployees { Employees = new BaseEmployee[] { new Worker { Name = "e" } } } }.AsQueryable(); // Act var cast = qry.Select(c => c.Employees.Cast<Worker>().Where(e => e.Name == "e")).ToArray(); var castDynamic = qry.Select("Employees.Cast(@0).Where(Name == \"e\")", typeof(Worker)).ToDynamicArray(); // Assert Check.That(cast.Length).Equals(castDynamic.Length); } [Fact] public void CastToType_FromStringToInt() { // Assign var qry = new[] { "1", "2" }.AsQueryable(); // Act var castDynamic = qry.Select("Cast(\"int\")").ToDynamicArray(); // Assert castDynamic.Should().BeEquivalentTo(new[] { 1, 2 }); } // #440 [Fact] public void CastToIntUsingParentheses() { // Assign var qry = new[] { new User { Id = 1, DisplayName = "" + (char) 109 }, new User { Id = 2, DisplayName = "abc" } }.AsQueryable(); // Act var result1 = qry.Where("DisplayName.Any(int(it) >= 109) and Id > 0").ToDynamicArray<User>(); var result2 = qry.Where("Id > 0 && DisplayName.Any(int(it) >= 109)").ToDynamicArray<User>(); // Assert result1.Should().HaveCount(1).And.Subject.First().Id.Should().Be(1); result2.Should().HaveCount(1).And.Subject.First().Id.Should().Be(1); } [Fact] public void CastToType_Dynamic_ActingOnIt() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1", Other = "x" }, new Worker { Name = "2" } }.AsQueryable(); // Act var cast = qry.Select(c => (Worker)c).ToArray(); var castDynamic = qry.Select("Cast(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\")").ToDynamicArray(); // Assert Check.That(cast.Length).Equals(castDynamic.Length); } [Fact] public void IsAndCastToType_Dynamic_ActingOnIt_And_GetProperty() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1", Other = "x" }, new Boss { Name = "2", Function = "y" } }.AsQueryable(); // Act var cast = qry.Select(c => c is Worker ? ((Worker)c).Other : "-").ToArray(); var castDynamic = qry.Select("iif(Is(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\"), Cast(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\").Other, \"-\")").ToDynamicArray(); // Assert Check.That(cast.Length).Equals(castDynamic.Length); } [Fact] public void IsAndCastToType_Dynamic_ActingOnProperty_And_GetProperty() { // Assign var qry = new[] { new EmployeeWrapper { Employee = new Worker { Name = "1", Other = "x" } }, new EmployeeWrapper { Employee = new Boss { Name = "2", Function = "y" } } }.AsQueryable(); // Act var cast = qry.Select(c => c.Employee is Worker ? ((Worker)c.Employee).Other : "-").ToArray(); var castDynamic = qry.Select("iif(Is(Employee, \"System.Linq.Dynamic.Core.Tests.Entities.Worker\"), Cast(Employee, \"System.Linq.Dynamic.Core.Tests.Entities.Worker\").Other, \"-\")").ToDynamicArray(); // Assert Check.That(cast.Length).Equals(castDynamic.Length); } [Fact] public void CastToType_Dynamic_ActingOnIt_WithType() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Worker { Name = "2" } }.AsQueryable(); // Act var cast = qry.Select(c => (Worker)c).ToArray(); var castDynamic = qry.Select("Cast(@0)", typeof(Worker)).ToDynamicArray(); // Assert Check.That(cast.Length).Equals(castDynamic.Length); } [Fact] public void CastToType_Dynamic_ActingOnIt_Throws() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Boss { Name = "b" } }.AsQueryable(); // Act Action castDynamic = () => qry.Select("Cast(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\")").ToDynamicArray(); // Assert Check.ThatCode(castDynamic).Throws<Exception>(); } [Fact] public void OfType_Dynamic_Exceptions() { // Assign var qry = new[] { new CompanyWithBaseEmployees { Employees = new BaseEmployee[] { new Worker { Name = "e" }, new Boss { Name = "e" } } } }.AsQueryable(); // Act Assert.Throws<ParseException>(() => qry.Select("Employees.OfType().Where(Name == \"e\")")); Assert.Throws<ParseException>(() => qry.Select("Employees.OfType(true).Where(Name == \"e\")")); Assert.Throws<ParseException>(() => qry.Select("Employees.OfType(\"not-found\").Where(Name == \"e\")")); } [Fact] public void OfType_Dynamic_ActingOnIt_Exceptions() { // Assign var qry = new BaseEmployee[] { new Worker { Name = "1" }, new Boss { Name = "b" } }.AsQueryable(); // Act Assert.Throws<ParseException>(() => qry.Count("OfType()")); Assert.Throws<ParseException>(() => qry.Count("OfType(true)")); Assert.Throws<ParseException>(() => qry.Count("OfType(\"not-found\")")); } [Fact] public void CastToType_Dynamic_Exceptions() { // Assign var qry = new[] { new CompanyWithBaseEmployees { Employees = new BaseEmployee[] { new Worker { Name = "1" }, new Worker { Name = "2" } } } }.AsQueryable(); // Act Assert.Throws<ParseException>(() => qry.Select("Employees.Cast().Where(Name == \"1\")")); Assert.Throws<ParseException>(() => qry.Select("Employees.Cast(true).Where(Name == \"1\")")); Assert.Throws<ParseException>(() => qry.Select("Employees.Cast(\"not-found\").Where(Name == \"1\")")); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Is,OfType,As,Cast.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
4,206
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void ToArray_Dynamic() { // Arrange var testList = User.GenerateSampleModels(51); IQueryable testListQry = testList.AsQueryable(); // Act var realResult = testList.OrderBy(x => x.Roles.ToArray().First().Name).Select(x => x.Id); var testResult = testListQry.OrderBy("Roles.ToArray().First().Name").Select("Id"); // Assert Assert.Equal(realResult.ToArray(), testResult.ToDynamicArray().Cast<Guid>()); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.ToArray.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
148
```smalltalk // <auto-generated /> using System; using CodeFirst.DataAccess.Context; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace CodeFirst.DataAccess.Migrations.SqlServerDb { [DbContext(typeof(SqlServerDbContext))] [Migration("20220124205405_SqlServerInitialMigration")] partial class SqlServerInitialMigration { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .UseIdentityColumns() .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("ProductVersion", "5.0.1"); modelBuilder.Entity("CodeFirst.Models.Models.Actors", b => { b.Property<int>("ActorId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("actor_id") .UseIdentityColumn(); b.Property<DateTime?>("Birthday") .HasColumnType("datetime2") .HasColumnName("birthday"); b.Property<string>("Firstname") .HasColumnType("nvarchar(max)") .HasColumnName("first_name"); b.Property<string>("Lastname") .HasColumnType("nvarchar(max)") .HasColumnName("last_name"); b.HasKey("ActorId") .HasName("actor_pkey"); b.ToTable("actors"); b.HasData( new { ActorId = 1, Birthday = new DateTime(1947, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Arnold", Lastname = "Schwarzenegger" }, new { ActorId = 2, Birthday = new DateTime(1946, 2, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Anthony", Lastname = "Daniels" }, new { ActorId = 3, Birthday = new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harrison", Lastname = "Ford" }, new { ActorId = 4, Birthday = new DateTime(1956, 10, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Carrie", Lastname = "Fisher" }, new { ActorId = 5, Birthday = new DateTime(1914, 4, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Alec", Lastname = "Guiness" }, new { ActorId = 6, Birthday = new DateTime(1913, 5, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Peter", Lastname = "Cushing" }, new { ActorId = 7, Birthday = new DateTime(1944, 5, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "David", Lastname = "Prowse" }, new { ActorId = 8, Birthday = new DateTime(1935, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Peter", Lastname = "Mayhew" }, new { ActorId = 9, Birthday = new DateTime(1956, 7, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Michael", Lastname = "Biehn" }, new { ActorId = 10, Birthday = new DateTime(1956, 9, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Linda", Lastname = "Hamilton" }, new { ActorId = 11, Birthday = new DateTime(1950, 9, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Bill", Lastname = "Murray" }, new { ActorId = 12, Birthday = new DateTime(1952, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Dan", Lastname = "Aykroyd" }, new { ActorId = 13, Birthday = new DateTime(1949, 10, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Sigourney", Lastname = "Weaver" }, new { ActorId = 14, Birthday = new DateTime(1943, 8, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Robert", Lastname = "De Niro" }, new { ActorId = 15, Birthday = new DateTime(1962, 11, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Jodie", Lastname = "Foster" }, new { ActorId = 16, Birthday = new DateTime(1939, 5, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harvey", Lastname = "Keitel" }, new { ActorId = 17, Birthday = new DateTime(1950, 2, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Cybill", Lastname = "Shepherd" }, new { ActorId = 18, Birthday = new DateTime(1949, 5, 31, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Tom", Lastname = "Berenger" }, new { ActorId = 19, Birthday = new DateTime(1955, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Willem", Lastname = "Dafoe" }, new { ActorId = 20, Birthday = new DateTime(1965, 9, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Charlie", Lastname = "Sheen" }, new { ActorId = 21, Birthday = new DateTime(1942, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Harrison", Lastname = "Ford" }, new { ActorId = 22, Birthday = new DateTime(1966, 6, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Emmanuelle", Lastname = "Seigner" }, new { ActorId = 23, Birthday = new DateTime(1948, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Jean", Lastname = "Reno" }, new { ActorId = 24, Birthday = new DateTime(1948, 3, 14, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Billy", Lastname = "Crystal" }, new { ActorId = 25, Birthday = new DateTime(1963, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Lisa", Lastname = "Kudrow" }, new { ActorId = 26, Birthday = new DateTime(1958, 3, 21, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Gary", Lastname = "Oldman" }, new { ActorId = 27, Birthday = new DateTime(1981, 6, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Natalie", Lastname = "Portman" }, new { ActorId = 28, Birthday = new DateTime(1962, 7, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Tom", Lastname = "Cruise" }); }); modelBuilder.Entity("CodeFirst.Models.Models.Clients", b => { b.Property<int>("ClientId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("client_id") .UseIdentityColumn(); b.Property<DateTime?>("Birthday") .HasColumnType("datetime2") .HasColumnName("birthday"); b.Property<string>("Firstname") .HasColumnType("nvarchar(max)") .HasColumnName("first_name"); b.Property<string>("Lastname") .HasColumnType("nvarchar(max)") .HasColumnName("last_name"); b.HasKey("ClientId") .HasName("client_pkey"); b.ToTable("clients"); b.HasData( new { ClientId = 1, Birthday = new DateTime(1954, 4, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Hank", Lastname = "Hill" }, new { ClientId = 2, Birthday = new DateTime(2011, 9, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Brian", Lastname = "Griffin" }, new { ClientId = 3, Birthday = new DateTime(1989, 3, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Gary", Lastname = "Goodspeed" }, new { ClientId = 4, Birthday = new DateTime(1977, 1, 23, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Bob", Lastname = "Belcher" }, new { ClientId = 5, Birthday = new DateTime(2012, 5, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Lisa", Lastname = "Simpson" }, new { ClientId = 6, Birthday = new DateTime(1965, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), Firstname = "Rick", Lastname = "Sanchez" }); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.Property<int>("CopyId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("copy_id") .UseIdentityColumn(); b.Property<bool>("Available") .HasColumnType("bit") .HasColumnName("available"); b.Property<int>("MovieId") .HasColumnType("int") .HasColumnName("movie_id"); b.HasKey("CopyId") .HasName("copies_pkey"); b.HasIndex("MovieId"); b.ToTable("copies"); b.HasData( new { CopyId = 1, Available = true, MovieId = 1 }, new { CopyId = 2, Available = false, MovieId = 1 }, new { CopyId = 3, Available = true, MovieId = 2 }, new { CopyId = 4, Available = true, MovieId = 3 }, new { CopyId = 5, Available = false, MovieId = 3 }, new { CopyId = 6, Available = true, MovieId = 3 }, new { CopyId = 7, Available = true, MovieId = 4 }, new { CopyId = 8, Available = false, MovieId = 5 }, new { CopyId = 9, Available = true, MovieId = 6 }, new { CopyId = 10, Available = false, MovieId = 6 }, new { CopyId = 11, Available = true, MovieId = 6 }, new { CopyId = 12, Available = true, MovieId = 7 }, new { CopyId = 13, Available = true, MovieId = 7 }, new { CopyId = 14, Available = false, MovieId = 8 }, new { CopyId = 15, Available = true, MovieId = 9 }, new { CopyId = 16, Available = true, MovieId = 10 }, new { CopyId = 17, Available = false, MovieId = 10 }, new { CopyId = 18, Available = true, MovieId = 10 }, new { CopyId = 19, Available = true, MovieId = 10 }, new { CopyId = 20, Available = true, MovieId = 10 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Employees", b => { b.Property<int>("EmployeeId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("employee_id") .UseIdentityColumn(); b.Property<string>("City") .HasColumnType("nvarchar(max)"); b.Property<string>("Firstname") .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("first_name"); b.Property<string>("Lastname") .IsRequired() .HasColumnType("nvarchar(max)") .HasColumnName("last_name"); b.Property<float?>("Salary") .HasColumnType("real") .HasColumnName("salary"); b.HasKey("EmployeeId") .HasName("employee_id"); b.ToTable("employees"); b.HasData( new { EmployeeId = 1, City = "New York", Firstname = "John", Lastname = "Smith", Salary = 150f }, new { EmployeeId = 2, City = "New York", Firstname = "Ben", Lastname = "Johnson", Salary = 250f }, new { EmployeeId = 3, City = "New Orleans", Firstname = "Louis", Lastname = "Armstrong", Salary = 75f }, new { EmployeeId = 4, City = "London", Firstname = "John", Lastname = "Lennon", Salary = 300f }, new { EmployeeId = 5, City = "London", Firstname = "Peter", Lastname = "Gabriel", Salary = 150f }); }); modelBuilder.Entity("CodeFirst.Models.Models.Movies", b => { b.Property<int>("MovieId") .ValueGeneratedOnAdd() .HasColumnType("int") .HasColumnName("movie_id") .UseIdentityColumn(); b.Property<int>("AgeRestriction") .HasColumnType("int") .HasColumnName("age_restriction"); b.Property<float>("Price") .HasColumnType("real") .HasColumnName("price"); b.Property<string>("Title") .HasColumnType("nvarchar(max)") .HasColumnName("title"); b.Property<int>("Year") .HasColumnType("int") .HasColumnName("year"); b.HasKey("MovieId") .HasName("movies_pkey"); b.ToTable("movies"); b.HasData( new { MovieId = 1, AgeRestriction = 12, Price = 10f, Title = "Star Wars Episode IV: A New Hope", Year = 1979 }, new { MovieId = 2, AgeRestriction = 12, Price = 5.5f, Title = "Ghostbusters", Year = 1984 }, new { MovieId = 3, AgeRestriction = 15, Price = 8.5f, Title = "Terminator", Year = 1984 }, new { MovieId = 4, AgeRestriction = 17, Price = 5f, Title = "Taxi Driver", Year = 1976 }, new { MovieId = 5, AgeRestriction = 18, Price = 5f, Title = "Platoon", Year = 1986 }, new { MovieId = 6, AgeRestriction = 15, Price = 8.5f, Title = "Frantic", Year = 1988 }, new { MovieId = 7, AgeRestriction = 13, Price = 9.5f, Title = "Ronin", Year = 1998 }, new { MovieId = 8, AgeRestriction = 16, Price = 10.5f, Title = "Analyze This", Year = 1999 }, new { MovieId = 9, AgeRestriction = 16, Price = 8.5f, Title = "Leon: the Professional", Year = 1994 }, new { MovieId = 10, AgeRestriction = 13, Price = 8.5f, Title = "Mission Impossible", Year = 1996 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Rentals", b => { b.Property<int>("ClientId") .HasColumnType("int") .HasColumnName("client_id"); b.Property<int>("CopyId") .HasColumnType("int") .HasColumnName("copy_id"); b.Property<DateTime?>("DateOfRental") .HasColumnType("datetime2") .HasColumnName("date_of_rental"); b.Property<DateTime?>("DateOfReturn") .HasColumnType("datetime2") .HasColumnName("date_of_return"); b.HasKey("ClientId", "CopyId") .HasName("rentals_pkey"); b.HasIndex("CopyId"); b.ToTable("rentals"); b.HasData( new { ClientId = 1, CopyId = 1, DateOfRental = new DateTime(2005, 7, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 1, CopyId = 6, DateOfRental = new DateTime(2005, 7, 19, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 3, DateOfRental = new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 5, DateOfRental = new DateTime(2005, 7, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 27, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 2, CopyId = 7, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 12, DateOfRental = new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 20, DateOfRental = new DateTime(2005, 7, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 3, DateOfRental = new DateTime(2005, 7, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 23, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 3, CopyId = 7, DateOfRental = new DateTime(2005, 7, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 25, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 4, CopyId = 13, DateOfRental = new DateTime(2005, 7, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 5, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 5, CopyId = 11, DateOfRental = new DateTime(2005, 7, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 13, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 1, DateOfRental = new DateTime(2005, 7, 6, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 7, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 7, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }, new { ClientId = 6, CopyId = 19, DateOfRental = new DateTime(2005, 7, 29, 0, 0, 0, 0, DateTimeKind.Unspecified), DateOfReturn = new DateTime(2005, 7, 30, 0, 0, 0, 0, DateTimeKind.Unspecified) }); }); modelBuilder.Entity("CodeFirst.Models.Models.Starring", b => { b.Property<int>("ActorId") .HasColumnType("int") .HasColumnName("actor_id"); b.Property<int>("MovieId") .HasColumnType("int") .HasColumnName("movie_id"); b.HasKey("ActorId", "MovieId"); b.HasIndex("MovieId"); b.ToTable("starring"); b.HasData( new { ActorId = 2, MovieId = 1 }, new { ActorId = 3, MovieId = 1 }, new { ActorId = 4, MovieId = 1 }, new { ActorId = 5, MovieId = 1 }, new { ActorId = 6, MovieId = 1 }, new { ActorId = 7, MovieId = 1 }, new { ActorId = 8, MovieId = 1 }, new { ActorId = 1, MovieId = 3 }, new { ActorId = 9, MovieId = 3 }, new { ActorId = 10, MovieId = 3 }, new { ActorId = 11, MovieId = 2 }, new { ActorId = 12, MovieId = 2 }, new { ActorId = 13, MovieId = 2 }, new { ActorId = 14, MovieId = 4 }, new { ActorId = 15, MovieId = 4 }, new { ActorId = 16, MovieId = 4 }, new { ActorId = 17, MovieId = 4 }, new { ActorId = 18, MovieId = 5 }, new { ActorId = 19, MovieId = 5 }, new { ActorId = 20, MovieId = 5 }, new { ActorId = 21, MovieId = 6 }, new { ActorId = 22, MovieId = 6 }, new { ActorId = 14, MovieId = 7 }, new { ActorId = 23, MovieId = 7 }, new { ActorId = 14, MovieId = 8 }, new { ActorId = 24, MovieId = 8 }, new { ActorId = 25, MovieId = 8 }, new { ActorId = 23, MovieId = 9 }, new { ActorId = 27, MovieId = 9 }, new { ActorId = 23, MovieId = 10 }, new { ActorId = 28, MovieId = 10 }); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.HasOne("CodeFirst.Models.Models.Movies", "Movie") .WithMany("Copies") .HasForeignKey("MovieId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Movie"); }); modelBuilder.Entity("CodeFirst.Models.Models.Rentals", b => { b.HasOne("CodeFirst.Models.Models.Clients", "Client") .WithMany("Rentals") .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CodeFirst.Models.Models.Copies", "Copy") .WithMany("Rentals") .HasForeignKey("CopyId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Client"); b.Navigation("Copy"); }); modelBuilder.Entity("CodeFirst.Models.Models.Starring", b => { b.HasOne("CodeFirst.Models.Models.Actors", "Actor") .WithMany("Starring") .HasForeignKey("ActorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("CodeFirst.Models.Models.Movies", "Movie") .WithMany("Starring") .HasForeignKey("MovieId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Actor"); b.Navigation("Movie"); }); modelBuilder.Entity("CodeFirst.Models.Models.Actors", b => { b.Navigation("Starring"); }); modelBuilder.Entity("CodeFirst.Models.Models.Clients", b => { b.Navigation("Rentals"); }); modelBuilder.Entity("CodeFirst.Models.Models.Copies", b => { b.Navigation("Rentals"); }); modelBuilder.Entity("CodeFirst.Models.Models.Movies", b => { b.Navigation("Copies"); b.Navigation("Starring"); }); #pragma warning restore 612, 618 } } } ```
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Migrations/SqlServerDb/20220124205405_SqlServerInitialMigration.Designer.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
6,656
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using System.Threading.Tasks; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public async Task Entities_SumAsync_Integer() { // Arrange var expected = await _context.Blogs.Select(b => b.BlogId).SumAsync(); // Act var actual = await _context.Blogs.Select("BlogId").SumAsync(); // Assert Assert.Equal(expected, actual); } [Fact] public async Task Entities_SumAsync_Double() { // Arrange var expected = await _context.Blogs.Select(b => b.BlogId * 1.0d).SumAsync(); // Act var actual = await _context.Blogs.Select("BlogId").SumAsync(); // Assert Assert.Equal(expected, actual); } [Fact] public async Task Entities_SumAsync_Integer_Selector() { // Arrange var expected = await _context.Blogs.SumAsync(b => b.BlogId); // Act var actual = await _context.Blogs.SumAsync("BlogId"); // Assert Assert.Equal(expected, actual); } [Fact] public async Task Entities_SumAsync_Double_Selector() { // Arrange var expected = await _context.Blogs.SumAsync(b => b.BlogId * 1.0d); // Act var actual = await _context.Blogs.SumAsync("BlogId * 1.0d"); // Assert Assert.Equal(expected, actual); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.SumAsync.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
366
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using System.Threading.Tasks; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_AverageAsync() { // Arrange double expected = _context.Blogs.Select(b => b.BlogId).AverageAsync().GetAwaiter().GetResult(); // Act double actual = _context.Blogs.Select("BlogId").AverageAsync().GetAwaiter().GetResult(); // Assert Assert.Equal(expected, actual); } [Fact] public async Task Entities_AverageAsync_Selector() { // Arrange double expected = await _context.Blogs.AverageAsync(b => b.BlogId); // Act double actual = await _context.Blogs.AverageAsync("BlogId"); // Assert Assert.Equal(expected, actual); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.AverageAsync.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
213
```smalltalk using System.Collections.Generic; using System.Dynamic; using System.Linq.Dynamic.Core.Tests.TestHelpers; using FluentAssertions; using Newtonsoft.Json; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public class DynamicClassTest { public DynamicClassTest() { DynamicClassFactory.ClearGeneratedTypes(); } [Fact] public void DynamicClass_Equals() { // Arrange var props = new[] { new DynamicProperty("Name", typeof(string)), new DynamicProperty("Birthday", typeof(DateTime)) }; var type = DynamicClassFactory.CreateType(props); // Act dynamic dynamicInstance1 = Activator.CreateInstance(type)!; dynamicInstance1.Name = "Albert"; dynamicInstance1.Birthday = new DateTime(1879, 3, 14); dynamic dynamicInstance2 = Activator.CreateInstance(type)!; dynamicInstance2.Name = "Albert"; dynamicInstance2.Birthday = new DateTime(1879, 3, 14); bool equal1 = dynamicInstance1.Equals(dynamicInstance2); equal1.Should().BeTrue(); bool equal2 = dynamicInstance2.Equals(dynamicInstance1); equal2.Should().BeTrue(); } [Fact] public void DynamicClass_OperatorEqualityAndNotEquality() { // Arrange var props = new[] { new DynamicProperty("Name", typeof(string)), new DynamicProperty("Birthday", typeof(DateTime)) }; var type = DynamicClassFactory.CreateType(props); // Act dynamic dynamicInstance1 = Activator.CreateInstance(type)!; dynamicInstance1.Name = "Albert"; dynamicInstance1.Birthday = new DateTime(1879, 3, 14); dynamic dynamicInstance2 = Activator.CreateInstance(type)!; dynamicInstance2.Name = "Albert"; dynamicInstance2.Birthday = new DateTime(1879, 3, 14); bool equal1 = dynamicInstance1 == dynamicInstance2; equal1.Should().BeTrue(); bool equal2 = dynamicInstance2 == dynamicInstance1; equal2.Should().BeTrue(); bool notEqual1 = dynamicInstance1 != dynamicInstance2; notEqual1.Should().BeFalse(); bool notEqual2 = dynamicInstance2 != dynamicInstance1; notEqual2.Should().BeFalse(); } [Fact] public void DynamicClass_GetProperties_Should_Work() { // Arrange var range = new List<object> { new { FieldName = "TestFieldName", Value = 3.14159 } }; // Act var rangeResult = range.AsQueryable().Select("new(FieldName as FieldName)").ToDynamicList(); var item = rangeResult.First(); var call = () => item.GetDynamicMemberNames(); call.Should().NotThrow(); } [Fact] public void DynamicClass_GetPropertyValue_Should_Work() { // Arrange var test = "Test"; var range = new List<object> { new { FieldName = test, Value = 3.14159 } }; // Act var rangeResult = range.AsQueryable().Select("new(FieldName as FieldName)").ToDynamicList(); var item = rangeResult.First(); var value = item.FieldName as string; value.Should().Be(test); } [Fact] public void DynamicClass_GettingValue_ByIndex_Should_Work() { // Arrange var test = "Test"; var range = new List<object> { new { FieldName = test, Value = 3.14159 } }; // Act var rangeResult = range.AsQueryable().Select("new(FieldName as FieldName)").ToDynamicList(); var item = rangeResult.First(); var value = item["FieldName"] as string; value.Should().Be(test); } [Fact] public void DynamicClass_SettingExistingPropertyValue_ByIndex_Should_Work() { // Arrange var test = "Test"; var newTest = "abc"; var range = new List<object> { new { FieldName = test, Value = 3.14159 } }; // Act var rangeResult = range.AsQueryable().Select("new(FieldName as FieldName)").ToDynamicList(); var item = rangeResult.First(); item["FieldName"] = newTest; var value = item["FieldName"] as string; value.Should().Be(newTest); } [Fact] public void DynamicClass_SettingNewProperty_ByIndex_Should_Work() { // Arrange var test = "Test"; var newTest = "abc"; var range = new List<object> { new { FieldName = test, Value = 3.14159 } }; // Act var rangeResult = range.AsQueryable().Select("new(FieldName as FieldName)").ToDynamicList(); var item = rangeResult.First(); item["X"] = newTest; var value = item["X"] as string; value.Should().Be(newTest); } [Fact] public void DynamicClass_SerializeToNewtonsoftJson_Should_Work() { // Arrange var props = new[] { new DynamicProperty("Name", typeof(string)), new DynamicProperty("Birthday", typeof(DateTime)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue("Name", "Albert"); dynamicClass.SetDynamicPropertyValue("Birthday", new DateTime(1879, 3, 14)); // Act var json = JsonConvert.SerializeObject(dynamicClass); // Assert json.Should().Be("{\"Name\":\"Albert\",\"Birthday\":\"1879-03-14T00:00:00\"}"); } private static Type GetRuntimeType<TValue>(in TValue value) { return typeof(TValue); } [Fact] public void DynamicClass_GetRuntimeType() { // Arrange var props = new[] { new DynamicProperty("Name", typeof(string)), new DynamicProperty("Birthday", typeof(DateTime)) }; var type = DynamicClassFactory.CreateType(props); // Act var dynamicInstance = (DynamicClass)Activator.CreateInstance(type)!; // Assert 1 var getType = dynamicInstance.GetType(); getType.ToString().Should().StartWith("<>f__AnonymousType").And.EndWith("`2"); // Assert 2 var typeOf = GetRuntimeType(dynamicInstance); typeOf.ToString().Should().Be("System.Linq.Dynamic.Core.DynamicClass"); } [SkipIfGitHubActions] public void DynamicClassArray() { // Arrange var field = new { Name = "firstName", Value = "firstValue" }; var dynamicClasses = new List<DynamicClass>(); var props = new DynamicProperty[] { new (field.Name, typeof(string)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue(field.Name, field.Value); dynamicClasses.Add(dynamicClass); var query = dynamicClasses.AsQueryable(); // Act var isValid = query.Any("firstName eq \"firstValue\""); // Assert isValid.Should().BeTrue(); } [SkipIfGitHubActions] public void DynamicClassArray_Issue593_Fails() { // Arrange var field = new { Name = "firstName", Value = string.Concat("first", "Value") }; var dynamicClasses = new List<DynamicClass>(); var props = new DynamicProperty[] { new (field.Name, typeof(string)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue(field.Name, field.Value); dynamicClasses.Add(dynamicClass); var query = dynamicClasses.AsQueryable(); // Act var isValid = query.Any("firstName eq \"firstValue\""); // Assert isValid.Should().BeFalse(); // This should actually be true, but fails. For solution see Issue593_Solution1 and Issue593_Solution2. } [SkipIfGitHubActions] public void DynamicClassArray_Issue593_Solution1() { // Arrange var field = new { Name = "firstName", Value = string.Concat("first", "Value") }; var dynamicClasses = new List<DynamicClass>(); var props = new DynamicProperty[] { new (field.Name, typeof(string)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue(field.Name, field.Value); dynamicClasses.Add(dynamicClass); var query = dynamicClasses.AsQueryable(); // Act var isValid = query.Any("firstName.ToString() eq \"firstValue\""); // Assert isValid.Should().BeTrue(); } [SkipIfGitHubActions] public void DynamicClassArray_Issue593_Solution2() { // Arrange var field = new { Name = "firstName", Value = string.Concat("first", "Value") }; var dynamicClasses = new List<DynamicClass>(); var props = new DynamicProperty[] { new (field.Name, typeof(string)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue(field.Name, field.Value); dynamicClasses.Add(dynamicClass); var query = dynamicClasses.AsQueryable(); // Act var isValid = query.Any("string(firstName) eq \"firstValue\""); // Assert isValid.Should().BeTrue(); } #if NET6_0_OR_GREATER [Fact] public void ExpandoObject_SerializeToSystemTextJson_Should_Work() { // Arrange dynamic expandoObject = new ExpandoObject(); expandoObject.Name = "Albert"; expandoObject.Birthday = new DateTime(1879, 3, 14); // Act string json = Text.Json.JsonSerializer.Serialize(expandoObject); // Assert json.Should().Be("{\"Name\":\"Albert\",\"Birthday\":\"1879-03-14T00:00:00\"}"); } [Fact(Skip = "fails")] public void DynamicClass_SerializeToSystemTextJson_Should_Work() { // Arrange var props = new[] { new DynamicProperty("Name", typeof(string)), new DynamicProperty("Birthday", typeof(DateTime)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue("Name", "Albert"); dynamicClass.SetDynamicPropertyValue("Birthday", new DateTime(1879, 3, 14)); // Act var json = Text.Json.JsonSerializer.Serialize(dynamicClass); // Assert json.Should().Be("{\"Name\":\"Albert\",\"Birthday\":\"1879-03-14T00:00:00\"}"); } [Fact] public void DynamicClass_SerializeToSystemTextJson_TypeOfObject_Should_Work() { // Arrange var props = new[] { new DynamicProperty("Name", typeof(string)), new DynamicProperty("Birthday", typeof(DateTime)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue("Name", "Albert"); dynamicClass.SetDynamicPropertyValue("Birthday", new DateTime(1879, 3, 14)); // Act var json = Text.Json.JsonSerializer.Serialize(dynamicClass, typeof(object)); // Assert json.Should().Be("{\"Name\":\"Albert\",\"Birthday\":\"1879-03-14T00:00:00\"}"); } [Fact] public void your_sha256_hash_Work() { // Arrange var props = new[] { new DynamicProperty("Name", typeof(string)), new DynamicProperty("Birthday", typeof(DateTime)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue("Name", "Albert"); dynamicClass.SetDynamicPropertyValue("Birthday", new DateTime(1879, 3, 14)); // Act var json = Text.Json.JsonSerializer.Serialize(dynamicClass, type); // Assert json.Should().Be("{\"Name\":\"Albert\",\"Birthday\":\"1879-03-14T00:00:00\"}"); } [Fact(Skip = "fails")] public void your_sha256_hash_Work() { // Arrange var props = new[] { new DynamicProperty("Name", typeof(string)), new DynamicProperty("Birthday", typeof(DateTime)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type)!; dynamicClass.SetDynamicPropertyValue("Name", "Albert"); dynamicClass.SetDynamicPropertyValue("Birthday", new DateTime(1879, 3, 14)); // Act var json = Text.Json.JsonSerializer.Serialize(dynamicClass, typeof(DynamicClass)); // Assert json.Should().Be("{\"Name\":\"Albert\",\"Birthday\":\"1879-03-14T00:00:00\"}"); } #endif } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/DynamicClassTest.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
2,891
```smalltalk using System.Collections.Generic; using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using NFluent; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void GroupJoin_1() { //Arrange Person magnus = new Person { Name = "Hedlund, Magnus" }; Person terry = new Person { Name = "Adams, Terry" }; Person charlotte = new Person { Name = "Weiss, Charlotte" }; Pet barley = new Pet { Name = "Barley", Owner = terry }; Pet boots = new Pet { Name = "Boots", Owner = terry }; Pet whiskers = new Pet { Name = "Whiskers", Owner = charlotte }; Pet daisy = new Pet { Name = "Daisy", Owner = magnus }; var people = new List<Person> { magnus, terry, charlotte }; var petsList = new List<Pet> { barley, boots, whiskers, daisy }; //Act var realQuery = people.AsQueryable().GroupJoin( petsList, person => person, pet => pet.Owner, (person, pets) => new { OwnerName = person.Name, Pets = pets, NumberOfPets = pets.Count() }); var dynamicQuery = people.AsQueryable().GroupJoin( petsList, "it", "Owner", "new(outer.Name as OwnerName, inner as Pets, inner.Count() as NumberOfPets)"); //Assert var realResult = realQuery.ToArray(); #if NETSTANDARD var dynamicResult = dynamicQuery.ToDynamicArray<DynamicClass>(); Assert.Equal(realResult.Length, dynamicResult.Length); for (int i = 0; i < realResult.Length; i++) { Assert.Equal(realResult[i].OwnerName, dynamicResult[i].GetDynamicPropertyValue<string>("OwnerName")); Assert.Equal(realResult[i].NumberOfPets, dynamicResult[i].GetDynamicPropertyValue<int>("NumberOfPets")); for (int j = 0; j < realResult[i].Pets.Count(); j++) { Assert.Equal(realResult[i].Pets.ElementAt(j).Name, dynamicResult[i].GetDynamicPropertyValue<IEnumerable<Pet>>("Pets").ElementAt(j).Name); } } #else var dynamicResult = dynamicQuery.ToDynamicArray(); Assert.Equal(realResult.Length, dynamicResult.Length); for (int i = 0; i < realResult.Length; i++) { Assert.Equal(realResult[i].OwnerName, ((dynamic) dynamicResult[i]).OwnerName); Assert.Equal(realResult[i].NumberOfPets, ((dynamic) dynamicResult[i]).NumberOfPets); for (int j = 0; j < realResult[i].Pets.Count(); j++) { Assert.Equal(realResult[i].Pets.ElementAt(j).Name, (((IEnumerable<Pet>)((dynamic)dynamicResult[i]).Pets)).ElementAt(j).Name); } } #endif } [Fact] public void GroupJoin_2() { //Arrange Person magnus = new Person { Name = "Hedlund, Magnus" }; Person terry = new Person { Name = "Adams, Terry" }; Person charlotte = new Person { Name = "Weiss, Charlotte" }; Pet barley = new Pet { Name = "Barley", Owner = terry }; Pet boots = new Pet { Name = "Boots", Owner = terry }; Pet whiskers = new Pet { Name = "Whiskers", Owner = charlotte }; Pet daisy = new Pet { Name = "Daisy", Owner = magnus }; var people = new List<Person> { magnus, terry, charlotte }; var petsList = new List<Pet> { barley, boots, whiskers, daisy }; //Act var realQuery = people.AsQueryable().GroupJoin( petsList, person => person.Id, pet => pet.OwnerId, (person, pets) => new { OwnerName = person.Name, Pets = pets, NumberOfPets = pets.Count() }); var dynamicQuery = people.AsQueryable().GroupJoin( petsList, "it.Id", "OwnerId", "new(outer.Name as OwnerName, inner as Pets, inner.Count() as NumberOfPets)"); //Assert var realResult = realQuery.ToArray(); #if NETSTANDARD var dynamicResult = dynamicQuery.ToDynamicArray<DynamicClass>(); Assert.Equal(realResult.Length, dynamicResult.Length); for (int i = 0; i < realResult.Length; i++) { Assert.Equal(realResult[i].OwnerName, dynamicResult[i].GetDynamicPropertyValue<string>("OwnerName")); Assert.Equal(realResult[i].NumberOfPets, dynamicResult[i].GetDynamicPropertyValue<int>("NumberOfPets")); for (int j = 0; j < realResult[i].Pets.Count(); j++) { Assert.Equal(realResult[i].Pets.ElementAt(j).Name, dynamicResult[i].GetDynamicPropertyValue<IEnumerable<Pet>>("Pets").ElementAt(j).Name); } } #else var dynamicResult = dynamicQuery.ToDynamicArray(); Assert.Equal(realResult.Length, dynamicResult.Length); for (int i = 0; i < realResult.Length; i++) { Assert.Equal(realResult[i].OwnerName, ((dynamic) dynamicResult[i]).OwnerName); Assert.Equal(realResult[i].NumberOfPets, ((dynamic) dynamicResult[i]).NumberOfPets); for (int j = 0; j < realResult[i].Pets.Count(); j++) { Assert.Equal(realResult[i].Pets.ElementAt(j).Name, (((IEnumerable<Pet>)((dynamic)dynamicResult[i]).Pets)).ElementAt(j).Name); } } #endif } public class Employee { // [Key] public int EmployeeId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public int Age { get; set; } public ICollection<Paycheck> Paychecks { get; set; } = new List<Paycheck>(); } public class Paycheck { // [Key] public int PaycheckId { get; set; } public decimal HourlyWage { get; set; } public int HoursWorked { get; set; } public DateTimeOffset DateCreated { get; set; } // [ForeignKey("EmployeeId")] public Employee Employee { get; set; } public int EmployeeId { get; set; } } [Fact] public void GroupJoin_3() { // Arrange var employees = new List<Employee>(); var paychecks = new List<Paycheck>(); // Act var realQuery = employees.AsQueryable().GroupJoin( paychecks, employee => employee.EmployeeId, paycheck => paycheck.EmployeeId, (emp, paycheckList) => new { Name = emp.FirstName + " " + emp.LastName, NumberOfPaychecks = paycheckList.Count() }); var dynamicQuery = employees.AsQueryable().GroupJoin( paychecks, "it.EmployeeId", "EmployeeId", "new(outer.FirstName + \" \" + outer.LastName as Name, inner.Count() as NumberOfPaychecks)"); // Assert var realResult = realQuery.ToArray(); Check.That(realResult).IsNotNull(); var dynamicResult = dynamicQuery.ToDynamicArray(); Check.That(dynamicResult).IsNotNull(); } [Fact] public void GroupJoinOnNullableType_RightNullable() { //Arrange Person magnus = new Person { Id = 1, Name = "Hedlund, Magnus" }; Person terry = new Person { Id = 2, Name = "Adams, Terry" }; Person charlotte = new Person { Id = 3, Name = "Weiss, Charlotte" }; Pet barley = new Pet { Name = "Barley", NullableOwnerId = terry.Id }; Pet boots = new Pet { Name = "Boots", NullableOwnerId = terry.Id }; Pet whiskers = new Pet { Name = "Whiskers", NullableOwnerId = charlotte.Id }; Pet daisy = new Pet { Name = "Daisy", NullableOwnerId = magnus.Id }; var people = new List<Person> { magnus, terry, charlotte }; var petsList = new List<Pet> { barley, boots, whiskers, daisy }; //Act var realQuery = people.AsQueryable().GroupJoin( petsList, person => person.Id, pet => pet.NullableOwnerId, (person, pets) => new { OwnerName = person.Name, Pets = pets }); var dynamicQuery = people.AsQueryable().GroupJoin( petsList, "it.Id", "NullableOwnerId", "new(outer.Name as OwnerName, inner as Pets)"); //Assert var realResult = realQuery.ToArray(); var dynamicResult = dynamicQuery.ToDynamicArray<DynamicClass>(); Assert.Equal(realResult.Length, dynamicResult.Length); for (int i = 0; i < realResult.Length; i++) { Assert.Equal(realResult[i].OwnerName, dynamicResult[i].GetDynamicPropertyValue<string>("OwnerName")); for (int j = 0; j < realResult[i].Pets.Count(); j++) { Assert.Equal(realResult[i].Pets.ElementAt(j).Name, dynamicResult[i].GetDynamicPropertyValue<IEnumerable<Pet>>("Pets").ElementAt(j).Name); } } } [Fact] public void GroupJoinOnNullableType_LeftNullable() { //Arrange Person magnus = new Person { NullableId = 1, Name = "Hedlund, Magnus" }; Person terry = new Person { NullableId = 2, Name = "Adams, Terry" }; Person charlotte = new Person { NullableId = 3, Name = "Weiss, Charlotte" }; Pet barley = new Pet { Name = "Barley", OwnerId = terry.Id }; Pet boots = new Pet { Name = "Boots", OwnerId = terry.Id }; Pet whiskers = new Pet { Name = "Whiskers", OwnerId = charlotte.Id }; Pet daisy = new Pet { Name = "Daisy", OwnerId = magnus.Id }; var people = new List<Person> { magnus, terry, charlotte }; var petsList = new List<Pet> { barley, boots, whiskers, daisy }; //Act var realQuery = people.AsQueryable().GroupJoin( petsList, person => person.NullableId, pet => pet.OwnerId, (person, pets) => new { OwnerName = person.Name, Pets = pets }); var dynamicQuery = people.AsQueryable().GroupJoin( petsList, "it.NullableId", "OwnerId", "new(outer.Name as OwnerName, inner as Pets)"); //Assert var realResult = realQuery.ToArray(); var dynamicResult = dynamicQuery.ToDynamicArray<DynamicClass>(); Assert.Equal(realResult.Length, dynamicResult.Length); for (int i = 0; i < realResult.Length; i++) { Assert.Equal(realResult[i].OwnerName, dynamicResult[i].GetDynamicPropertyValue<string>("OwnerName")); for (int j = 0; j < realResult[i].Pets.Count(); j++) { Assert.Equal(realResult[i].Pets.ElementAt(j).Name, dynamicResult[i].GetDynamicPropertyValue<IEnumerable<Pet>>("Pets").ElementAt(j).Name); } } } [Fact] public void GroupJoinOnNullableType_NotSameTypesThrowsException() { var person = new Person { Id = 1, Name = "Hedlund, Magnus" }; var people = new List<Person> { person }; var pets = new List<Pet> { new Pet { Name = "Daisy", OwnerId = person.Id } }; Check.ThatCode(() => people.AsQueryable() .GroupJoin( pets, "it.Id", "Name", // This is wrong "new(outer.Name as OwnerName, inner as Pets)")).Throws<ParseException>(); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.GroupJoin.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
2,633
```smalltalk using System.Collections.Generic; using FluentAssertions; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Intersect_Dynamic_ListOfStrings() { // Arrange var list1 = new List<bool> { true }; var list2 = new List<string> { "User3", "User4" }; var list3 = new List<string> { "User3", "User6", "User7" }; // Act var testQuery = list1.AsQueryable().Select("@0.Intersect(@1).ToList()", list2, list3); // Assert var result = testQuery.ToDynamicArray<List<string>>(); result.First().Should().BeEquivalentTo(list2.Intersect(list3)); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Intersect.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
173
```smalltalk using System.Collections; using System.Linq.Dynamic.Core.Tests.Helpers.Entities; #if EFCORE using Microsoft.EntityFrameworkCore; #else using System.Data.Entity; #endif using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_GroupBy_SingleKey() { // "memory leak" warning exception starting from EF Core 3.x #if !EFCORE_3X // Arrange var expected = _context.Posts.GroupBy(x => x.BlogId).ToArray(); // Act var test = _context.Posts.GroupBy("BlogId").ToDynamicArray(); // Assert Assert.Equal(expected.Length, test.Length); for (int i = 0; i < expected.Length; i++) { var expectedRow = expected[i]; //For some reason, the DynamicBinder doesn't allow us to access values of the Group object, so we have to cast first var testRow = (IGrouping<int, Post>)test[i]; Assert.Equal(expectedRow.Key, testRow.Key); Assert.Equal(expectedRow.ToArray(), testRow.ToArray()); } #endif } [Fact] public void Entities_GroupBy_MultiKey() { // "memory leak" warning exception starting from EF Core 3.x #if !EFCORE_3X // Arrange var expected = _context.Posts.GroupBy(x => new { x.BlogId, x.PostDate }).OrderBy(x => x.Key.PostDate).ToArray(); // Act var test = _context.Posts.GroupBy("new (BlogId, PostDate)").OrderBy("Key.PostDate").ToDynamicArray(); // Assert Assert.Equal(expected.Length, test.Length); for (int i = 0; i < expected.Length; i++) { var expectedRow = expected[i]; //For some reason, the DynamicBinder doesn't allow us to access values of the Group object, so we have to cast first var testRow = (IGrouping<DynamicClass, Post>)test[i]; Assert.Equal(expectedRow.Key.BlogId, ((dynamic)testRow.Key).BlogId); Assert.Equal(expectedRow.Key.PostDate, ((dynamic)testRow.Key).PostDate); Assert.Equal(expectedRow.ToArray(), testRow.ToArray()); } #endif } [Fact] public void Entities_GroupBy_SingleKey_SingleResult() { // "memory leak" warning exception starting from EF Core 3.x #if !EFCORE_3X // Arrange var expected = _context.Posts.GroupBy(x => x.PostDate, x => x.Title).ToArray(); // Act var test = _context.Posts.GroupBy("PostDate", "Title").ToDynamicArray(); // Assert Assert.Equal(expected.Length, test.Length); for (int i = 0; i < expected.Length; i++) { var expectedRow = expected[i]; //For some reason, the DynamicBinder doesn't allow us to access values of the Group object, so we have to cast first var testRow = (IGrouping<DateTime, string>)test[i]; Assert.Equal(expectedRow.Key, testRow.Key); Assert.Equal(expectedRow.ToArray(), testRow.ToArray()); } #endif } [Fact] public void Entities_GroupBy_SingleKey_MultiResult() { // "memory leak" warning exception starting from EF Core 3.x #if !EFCORE_3X // Arrange var expected = _context.Posts.GroupBy(x => x.PostDate, x => new { x.Title, x.Content }).ToArray(); // Act var test = _context.Posts.GroupBy("PostDate", "new (Title, Content)").ToDynamicArray(); // Assert Assert.Equal(expected.Length, test.Length); for (int i = 0; i < expected.Length; i++) { var expectedRow = expected[i]; //For some reason, the DynamicBinder doesn't allow us to access values of the Group object, so we have to cast first var testRow = (IGrouping<DateTime, DynamicClass>)test[i]; Assert.Equal(expectedRow.Key, testRow.Key); Assert.Equal( expectedRow.ToArray(), testRow.Cast<dynamic>().Select(x => new { Title = (string)x.Title, Content = (string)x.Content }).ToArray()); } #endif } [Fact] public void Entities_GroupBy_SingleKey_Count() { // Arrange var expected = _context.Posts.GroupBy(x => x.PostDate).Select(x => new { x.Key, Count = x.Count() }).ToArray(); // Act var test = _context.Posts.GroupBy("PostDate").Select("new(Key, Count() AS Count)").ToDynamicArray(); // Assert Assert.Equal(expected.Length, test.Length); for (int i = 0; i < expected.Length; i++) { var expectedRow = expected[i]; var testRow = test[i]; Assert.Equal(expectedRow.Key, testRow.Key); Assert.Equal(expectedRow.Count, testRow.Count); } } [Fact] public void Entities_GroupBy_SingleKey_Sum() { // Arrange var expected = _context.Posts.GroupBy(x => x.PostDate).Select(x => new { x.Key, Reads = x.Sum(y => y.NumberOfReads) }).ToArray(); // Act var test = _context.Posts.GroupBy("PostDate").Select("new(Key, Sum(NumberOfReads) AS Reads)").ToDynamicArray(); // Assert Assert.Equal(expected.Length, test.Length); for (int i = 0; i < expected.Length; i++) { var expectedRow = expected[i]; var testRow = test[i]; Assert.Equal(expectedRow.Key, testRow.Key); Assert.Equal(expectedRow.Reads, testRow.Reads); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.GroupBy.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
1,276
```smalltalk using System.Collections; using System.Linq.Dynamic.Core.Exceptions; using Newtonsoft.Json; #if EFCORE using Microsoft.EntityFrameworkCore; #else using System.Data.Entity; #endif using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_Select_SingleColumn_NullCoalescing() { var expected1 = _context.Blogs.Select(x => (int?)(x.NullableInt ?? 10)).ToArray(); var expected2 = _context.Blogs.Select(x => (int?)(x.NullableInt ?? 9 + x.BlogId)).ToArray(); // Act var test1 = _context.Blogs.Select<int?>("NullableInt ?? 10").ToArray(); var test2 = _context.Blogs.Select<int?>("NullableInt ?? 9 + BlogId").ToArray(); // Assert Assert.Equal(expected1, test1); Assert.Equal(expected2, test2); } [Fact] public void Entities_Select_SingleColumn() { //Arrange var expected = _context.Blogs.Select(x => x.BlogId).ToArray(); //Act var test = _context.Blogs.Select<int>("BlogId").ToArray(); //Assert Assert.Equal<ICollection>(expected, test); } [Fact] public void Entities_Select_EmptyObject() { // Arrange ParsingConfig config = ParsingConfig.Default; config.EvaluateGroupByAtDatabase = true; var expected = _context.Blogs.Select(x => new { }).ToList(); // Act var test = _context.Blogs.GroupBy(config, "BlogId", "new()").Select<object>("new()").ToList(); // Assert Assert.Equal(JsonConvert.SerializeObject(expected), JsonConvert.SerializeObject(test)); } [Fact] public void Entities_Select_BrokenObject() { ParsingConfig config = ParsingConfig.Default; config.DisableMemberAccessToIndexAccessorFallback = false; // Silently creates something that will later fail on materialization var test = _context.Blogs.Select(config, "new(~.BlogId)"); test = test.Select(config, "new(nonexistentproperty as howcanthiswork)"); // Will fail when creating the expression config.DisableMemberAccessToIndexAccessorFallback = true; Assert.ThrowsAny<ParseException>(() => { test = test.Select(config, "new(nonexistentproperty as howcanthiswork)"); }); } [Fact] public void Entities_Select_MultipleColumn() { //Arrange var expected = _context.Blogs.Select(x => new { X = "x", x.BlogId, x.Name }).ToArray(); //Act var test = _context.Blogs.Select("new (\"x\" as X, BlogId, Name)").ToDynamicArray(); //Assert Assert.Equal( expected, test.Select(x => new { X = "x", BlogId = (int)x.BlogId, Name = (string)x.Name }).ToArray() // Convert to same anonymous type used by expected, so they can be found equal. ); } [Fact] public void Entities_Select_BlogPosts() { //Arrange var expected = _context.Blogs.Where(x => x.BlogId == 1).SelectMany(x => x.Posts).Select(x => x.PostId).ToArray(); //Act var test = _context.Blogs.Where(x => x.BlogId == 1).SelectMany("Posts").Select<int>("PostId").ToArray(); //Assert Assert.Equal(expected, test); } // fixed : EF issue !!! path_to_url [Fact] public void Entities_Select_BlogAndPosts() { //Arrange var expected = _context.Blogs.Select(x => new { x.BlogId, x.Name, x.Posts }).ToArray(); //Act var test = _context.Blogs.Select("new (BlogId, Name, Posts)").ToDynamicArray(); //Assert Assert.Equal(expected.Length, test.Length); for (int i = 0; i < expected.Length; i++) { var expectedRow = expected[i]; var testRow = test[i]; Assert.Equal(expectedRow.BlogId, testRow.BlogId); Assert.Equal(expectedRow.Name, testRow.Name); Assert.True(expectedRow.Posts != null); Assert.Equal(expectedRow.Posts.ToList(), testRow.Posts); } } /// <summary> /// #593 /// </summary> [Fact] public void Entities_Select_DynamicClass_And_Call_Any() { // Act var result = _context.Blogs .Select("new (BlogId, Name)") .Any("Name == \"Blog2\""); // Assert Assert.Equal(true, result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Select.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
1,031
```smalltalk using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Helpers; using System.Linq.Dynamic.Core.Tests.Helpers.Entities; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using System.Linq.Expressions; using FluentAssertions; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class QueryableTests { [Fact] public void Where_Dynamic() { // Arrange var testList = User.GenerateSampleModels(100, allowNullableProfiles: true); var qry = testList.AsQueryable(); // Act var userById = qry.Where("Id=@0", testList[10].Id); var userByUserName = qry.Where("UserName=\"User5\""); var nullProfileCount = qry.Where("Profile=null"); var userByFirstName = qry.Where("Profile!=null && Profile.FirstName=@0", testList[1].Profile!.FirstName); // Assert Assert.Equal(testList[10], userById.Single()); Assert.Equal(testList[5], userByUserName.Single()); Assert.Equal(testList.Count(x => x.Profile == null), nullProfileCount.Count()); Assert.Equal(testList[1], userByFirstName.Single()); } [Fact] public void Where_Dynamic_CheckCastToObject() { // Arrange var testList = User.GenerateSampleModels(100, allowNullableProfiles: true); var qry = testList.AsQueryable(); // Act string dynamicExpression = qry.Where("Profile == null").Expression.ToDebugView(); string expression = qry.Where(var1 => var1.Profile == null).Expression.ToDebugView(); // Assert NFluent.Check.That(dynamicExpression).Equals(expression); } [Theory] [InlineData("Fri, 10 May 2019 11:03:17 GMT", 11)] [InlineData("Fri, 10 May 2019 11:03:17 -07:00", 18)] public void Where_Dynamic_DateTimeIsParsedAsUTC(string time, int hours) { // Arrange var queryable = new[] { new Example { TimeNull = new DateTime(2019, 5, 10, hours, 3, 17, DateTimeKind.Utc) } }.AsQueryable(); // Act var parsingConfig = new ParsingConfig { DateTimeIsParsedAsUTC = true }; var result = queryable.Where(parsingConfig, $"it.TimeNull >= \"{time}\""); // Assert Assert.Equal(1, result.Count()); } /// <summary> /// path_to_url /// </summary> [Fact] public void Where_Dynamic_DateTime_NotEquals_Null() { // Arrange IQueryable<Post> queryable = new[] { new Post() }.AsQueryable(); // Act var expected = queryable.Where(p => p.PostDate != null).ToArray(); var result1 = queryable.Where("PostDate != null").ToArray(); var result2 = queryable.Where("null != PostDate").ToArray(); // Assert Assert.Equal(expected, result1); Assert.Equal(expected, result2); } [Fact] public void Where_Dynamic_DateTime_Equals_Null() { // Arrange IQueryable<Post> queryable = new[] { new Post() }.AsQueryable(); // Act var expected = queryable.Where(p => p.PostDate == null).ToArray(); var result1 = queryable.Where("PostDate == null").ToArray(); var result2 = queryable.Where("null == PostDate").ToArray(); // Assert Assert.Equal(expected, result1); Assert.Equal(expected, result2); } [Fact] public void Where_Dynamic_IQueryable_LambdaExpression() { // Arrange var queryable = (IQueryable)new[] { new User { Income = 5 } }.AsQueryable(); Expression<Func<User, bool>> userExpression = u => u.Income > 1; LambdaExpression lambdaExpression = userExpression; // Act var result = queryable.Where(lambdaExpression).ToDynamicArray(); // Assert result.Should().HaveCount(1); } [Fact] public void Where_Dynamic_IQueryableT_LambdaExpression() { // Arrange var queryable = new[] { new User { Income = 5 } }.AsQueryable(); Expression<Func<User, bool>> userExpression = u => u.Income > 1; LambdaExpression lambdaExpression = userExpression; // Act var result = queryable.Where(lambdaExpression); // Assert result.Should().HaveCount(1); } [Fact] public void Where_Dynamic_Exceptions() { // Arrange var testList = User.GenerateSampleModels(100, allowNullableProfiles: true); var qry = testList.AsQueryable(); // Act Assert.Throws<InvalidOperationException>(() => qry.Where("Id")); Assert.Throws<ParseException>(() => qry.Where("Bad=3")); Assert.Throws<ParseException>(() => qry.Where("Id=123")); Assert.Throws<ArgumentNullException>(() => DynamicQueryableExtensions.Where(null, "Id=1")); Assert.Throws<ArgumentNullException>(() => qry.Where((string?)null)); Assert.Throws<ArgumentException>(() => qry.Where("")); Assert.Throws<ArgumentException>(() => qry.Where(" ")); } [Fact] public void Where_Dynamic_StringQuoted() { // Arrange var testList = User.GenerateSampleModels(2, allowNullableProfiles: true); testList[0].UserName = @"This \""is\"" a test."; var qry = testList.AsQueryable(); // Act // var result1a = qry.Where(@"UserName == ""This \\""is\\"" a test.""").ToArray(); var result1b = qry.Where("UserName == \"This \\\\\\\"is\\\\\\\" a test.\"").ToArray(); var result2a = qry.Where("UserName == @0", @"This \""is\"" a test.").ToArray(); var result2b = qry.Where("UserName == @0", "This \\\"is\\\" a test.").ToArray(); var expected = qry.Where(x => x.UserName == @"This \""is\"" a test.").ToArray(); // Assert Assert.Single(expected); // Assert.Equal(expected, result1a); Assert.Equal(expected, result1b); Assert.Equal(expected, result2a); Assert.Equal(expected, result2b); } [Fact] public void Where_Dynamic_ConcatString() { // Arrange var qry = User.GenerateSampleModels(2).AsQueryable(); // Act var expected = qry.Where(u => (u.UserName + u.UserName).Length > 10).ToArray(); var result1 = qry.Where("(UserName + UserName).Length > 10").ToArray(); var result2 = qry.Where("u => (u.UserName + u.UserName).Length > 10").ToArray(); // Assert result1.Should().BeEquivalentTo(expected); result2.Should().BeEquivalentTo(expected); } [Fact] public void Where_Dynamic_EmptyString() { // Arrange var testList = User.GenerateSampleModels(2, allowNullableProfiles: true); var qry = testList.AsQueryable(); // Act var expected1 = qry.Where(u => u.UserName != string.Empty).ToArray(); var expected2 = qry.Where(u => u.UserName != "").ToArray(); var resultDynamic1 = qry.Where("UserName != @0", string.Empty).ToArray(); var resultDynamic2 = qry.Where("UserName != @0", "").ToArray(); // Assert resultDynamic1.Should().Contain(expected1); resultDynamic2.Should().Contain(expected2); } [Fact] public void Where_Dynamic_SelectNewObjects() { // Arrange var testList = User.GenerateSampleModels(100, allowNullableProfiles: true); var qry = testList.AsQueryable(); // Act var expectedResult = testList.Where(x => x.Income > 4000).Select(x => new { Id = x.Id, Income = x.Income + 1111 }); var dynamicList = qry.Where("Income > @0", 4000).ToDynamicList(); var newUsers = dynamicList.Select(x => new { Id = x.Id, Income = x.Income + 1111 }); Assert.Equal(newUsers.Cast<object>().ToList(), expectedResult); } [Fact] public void your_sha256_hashnvalidOperationException() { // Arrange var productsQuery = new[] { new ProductDynamic { ProductId = 1 } }.AsQueryable(); // Act Action action = () => productsQuery.Where("Properties.Name == @0", "First Product").ToDynamicList(); // Assert action.Should().Throw<InvalidOperationException>(); } [Fact(Skip = "NP does not work here")] public void your_sha256_hashgating() { // Arrange var productsQuery = new[] { new ProductDynamic { ProductId = 1 } }.AsQueryable(); // Act var results = productsQuery.Where("np(Properties.Name, \"no\") == @0", "First Product").ToDynamicList(); // Assert results.Should().HaveCount(0); } [Fact] public void Where_Dynamic_ExpandoObject_As_Dictionary() { // Arrange var productsQuery = new[] { new ProductDynamic { ProductId = 1, Properties = new Dictionary<string, object> { { "Name", "test" } } } }.AsQueryable(); // Act var results = productsQuery.Where("Properties.Name == @0", "test").ToDynamicList(); // Assert results.Should().HaveCount(1); } [Fact] public void Where_Dynamic_Object_As_Dictionary() { // Arrange var productsQuery = new[] { new ProductDynamic { ProductId = 1, PropertiesAsObject = new Dictionary<string, object> { { "Name", "test" } } } }.AsQueryable(); // Act var results = productsQuery.Where("PropertiesAsObject.Name == @0", "test").ToDynamicList(); // Assert results.Should().HaveCount(1); } [Fact] public void Where_Dynamic_ExpandoObject_As_AnonymousType() { // Arrange var productsQuery = new[] { new ProductDynamic { ProductId = 1, Properties = new { Name = "test" } } }.AsQueryable(); // Act var results = productsQuery.Where("Properties.Name == @0", "test").ToDynamicList<ProductDynamic>(); // Assert results.Should().HaveCount(1); } [Fact] public void Where_Dynamic_DateTimeConstructor_Issue662() { // Arrange var config = new ParsingConfig { PrioritizePropertyOrFieldOverTheType = false }; var date = new DateTime(2023, 1, 13, 12, 0, 0); var queryable = new List<Foo> { new() { DateTime = date }, new() { DT = date } }.AsQueryable(); // Act 1 var result1 = queryable.Where(config, "DT > DateTime(2022, 1, 1, 0, 0, 0)").ToArray(); // Assert 1 result1.Should().HaveCount(1); // Act 2 var result2 = queryable.Where(config, "it.DateTime > DateTime(2022, 1, 1, 0, 0, 0)").ToArray(); // Assert 2 result2.Should().HaveCount(1); } // #451 [Theory] [InlineData("Age == 99", 0)] [InlineData("Age != 99", 2)] [InlineData("Age <> 99", 2)] [InlineData("Age > 99", 0)] [InlineData("Age >= 99", 0)] [InlineData("Age < 99", 2)] [InlineData("Age <= 99", 2)] [InlineData("99 == Age", 0)] [InlineData("99 != Age", 2)] [InlineData("99 <> Age", 2)] [InlineData("99 > Age", 2)] [InlineData("99 >= Age", 2)] [InlineData("99 < Age", 0)] [InlineData("99 <= Age", 0)] public void your_sha256_hashnIsTrue(string expression, int expectedCount) { // Arrange var config = new ParsingConfig { ConvertObjectToSupportComparison = true }; var queryable = new[] { new PersonWithObject { Name = "Foo", DateOfBirth = DateTime.UtcNow.AddYears(-31) }, new PersonWithObject { Name = "Bar", DateOfBirth = DateTime.UtcNow.AddYears(-1) } }.AsQueryable(); // Act queryable.Where(config, expression).ToList().Should().HaveCount(expectedCount); } // #451 [Theory] [InlineData("Age == 99")] [InlineData("Age != 99")] [InlineData("Age <> 99")] [InlineData("Age > 99")] [InlineData("Age >= 99")] [InlineData("Age < 99")] [InlineData("Age <= 99")] [InlineData("99 == Age")] [InlineData("99 != Age")] [InlineData("99 <> Age")] [InlineData("99 > Age")] [InlineData("99 >= Age")] [InlineData("99 < Age")] [InlineData("99 <= Age")] public void your_sha256_hashnIsFalse_ThrowsException(string expression) { // Arrange var queryable = new[] { new PersonWithObject { Name = "Foo", DateOfBirth = DateTime.UtcNow.AddYears(-31) }, new PersonWithObject { Name = "Bar", DateOfBirth = DateTime.UtcNow.AddYears(-1) } }.AsQueryable(); // Act Action act = () => queryable.Where(expression); // Assert act.Should().Throw<InvalidOperationException>().And.Message.Should().MatchRegex("The binary operator .* is not defined for the types"); } [ExcludeFromCodeCoverage] private class PersonWithObject { // Deliberately typing these as `object` to illustrate the issue public object? Name { get; set; } public object Age => Convert.ToInt32(Math.Floor((DateTime.Today.Month - DateOfBirth.Month + 12 * DateTime.Today.Year - 12 * DateOfBirth.Year) / 12d)); public DateTime DateOfBirth { get; set; } } [ExcludeFromCodeCoverage] public class ProductDynamic { public int ProductId { get; set; } public dynamic? Properties { get; set; } public object? PropertiesAsObject { get; set; } } [ExcludeFromCodeCoverage] public class Foo { public DateTime DT { get; set; } public DateTime DateTime { get; set; } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Where.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
3,250
```smalltalk using System.Collections.Generic; using NFluent; using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using System.Reflection; using Newtonsoft.Json; using Xunit; using FluentAssertions; namespace System.Linq.Dynamic.Core.Tests; public partial class QueryableTests { public class DataSetA { public DateTime Time { get; set; } public int? I { get; set; } } public class DateTimeTest { public DateTimeTest? Test { get; set; } public DateTime? D { get; set; } } [Fact] public void GroupBy_Dynamic() { //Arrange var testList = User.GenerateSampleModels(100); var qry = testList.AsQueryable(); //Act var byAgeReturnUserName = qry.GroupBy("Profile.Age", "UserName"); var byAgeReturnAll = qry.GroupBy("Profile.Age"); //Assert Assert.Equal(testList.GroupBy(x => x.Profile.Age).Count(), byAgeReturnUserName.Count()); Assert.Equal(testList.GroupBy(x => x.Profile.Age).Count(), byAgeReturnAll.Count()); } [Fact] public void GroupBy_Dynamic_NullableDateTime() { // Arrange var qry = new[] { new DateTime(2020, 1, 1), (DateTime?)null }.AsQueryable(); // Act var byYear = qry.GroupBy("np(Value.Year, 2019)").ToDynamicArray(); // Assert byYear.Should().HaveCount(2); } [Fact] public void GroupBy_Dynamic_NullableDateTime_2Levels() { // Arrange var qry = new[] { new DateTimeTest { Test = new DateTimeTest { D = new DateTime(2020, 1, 1) } }, new DateTimeTest { Test = null } }.AsQueryable(); // Act var byYear = qry.GroupBy("np(Test.D.Value.Year, 2019)").ToDynamicArray(); // Assert byYear.Should().HaveCount(2); } [Fact] public void GroupBy_Dynamic_NullableDateTime_3Levels() { // Arrange var qry = new[] { new DateTimeTest { Test = new DateTimeTest { Test = new DateTimeTest { D = new DateTime(2020, 1, 1) } } }, new DateTimeTest { Test = null } }.AsQueryable(); // Act var byYear = qry.GroupBy("np(Test.Test.D.Value.Year, 2019)").ToDynamicArray(); // Assert byYear.Should().HaveCount(2); } // path_to_url [Fact] public void GroupBy_Dynamic_Issue75() { var testList = User.GenerateSampleModels(100); var resultDynamic = testList.AsQueryable().GroupBy("Profile.Age").Select("new (it.key as PropertyKey)"); var result = testList.GroupBy(e => e.Profile.Age).Select(e => new { PropertyKey = e.Key }).AsQueryable(); // I think this should be true, but it isn't. dynamicResult add System.Object Item [System.String] property. PropertyInfo[] properties = result.ElementType.GetTypeInfo().GetProperties(); PropertyInfo[] propertiesDynamic = resultDynamic.ElementType.GetTypeInfo().GetProperties(); Check.That(propertiesDynamic.Length).IsStrictlyGreaterThan(properties.Length); } [Fact] public void GroupBy_Dynamic_Exceptions() { //Arrange var testList = User.GenerateSampleModels(100, allowNullableProfiles: true); var qry = testList.AsQueryable(); //Act Assert.Throws<ParseException>(() => qry.GroupBy("Bad")); Assert.Throws<ParseException>(() => qry.GroupBy("Id, UserName")); Assert.Throws<ParseException>(() => qry.GroupBy("new Id, UserName")); Assert.Throws<ParseException>(() => qry.GroupBy("new (Id, UserName")); Assert.Throws<ParseException>(() => qry.GroupBy("new (Id, UserName, Bad)")); Assert.Throws<ArgumentNullException>(() => DynamicQueryableExtensions.GroupBy((IQueryable<string>)null, "Id")); Assert.Throws<ArgumentNullException>(() => qry.GroupBy(null)); Assert.Throws<ArgumentException>(() => qry.GroupBy("")); Assert.Throws<ArgumentException>(() => qry.GroupBy(" ")); Assert.Throws<ArgumentNullException>(() => qry.GroupBy("Id", (string)null)); Assert.Throws<ArgumentException>(() => qry.GroupBy("Id", "")); Assert.Throws<ArgumentException>(() => qry.GroupBy("Id", " ")); } [Fact(Skip = "This test is skipped because it fails in CI.")] public void GroupBy_Dynamic_Issue403() { var data = new List<object> { new { ItemCode = "AAAA", Flag = true, SoNo="aaa",JobNo="JNO01" } , new { ItemCode = "AAAA", Flag = true, SoNo="aaa",JobNo="JNO02" } , new { ItemCode = "AAAA", Flag = false, SoNo="aaa",JobNo="JNO03" } , new { ItemCode = "BBBB", Flag = true, SoNo="bbb",JobNo="JNO04" }, new { ItemCode = "BBBB", Flag = true, SoNo="bbb",JobNo="JNO05" } , new { ItemCode = "BBBB", Flag = true, SoNo="ccc",JobNo="JNO06" } , }; var jsonString = JsonConvert.SerializeObject(data); var list = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(jsonString); var groupList = list.AsQueryable().GroupBy("new (ItemCode, Flag)").ToDynamicList(); Assert.Equal(3, groupList.Count); } [Fact] public void GroupBy_Dynamic_SelectWhereMin() { // Arrange var q = new[] { new DataSetA { I = 5 }, new DataSetA { I = 7 } } .AsQueryable(); // Act var result = q .GroupBy(x => x.Time) .Select(x => new { q = x.Select(d => d.I).Where(d => d != null).Min() }) .ToArray(); var resultDynamic = q .GroupBy("Time") .Select("new (Select(I).Where(it != null).Min() as q)") .ToDynamicArray(); // Assert resultDynamic.Should().BeEquivalentTo(result); } [Fact] public void GroupBy_Dynamic_SelectWhereMax() { // Arrange var q = new[] { new DataSetA { I = 5 }, new DataSetA { I = 7 } } .AsQueryable(); // Act var result = q .GroupBy(x => x.Time) .Select(x => new { q = x.Select(d => d.I).Where(d => d != null).Max() }) .ToArray(); var resultDynamic = q .GroupBy("Time") .Select("new (Select(I).Where(it != null).Max() as q)") .ToDynamicArray(); // Assert resultDynamic.Should().BeEquivalentTo(result); } // #633 [Fact] public void GroupBy_Dynamic_SelectWhereAverage() { // Arrange var q = new[] { new DataSetA { I = 5 }, new DataSetA { I = 7 } } .AsQueryable(); // Act var result = q .GroupBy(x => x.Time) .Select(x => new { q = x.Select(d => d.I).Where(d => d != null).Average() }) .ToArray(); var resultDynamic = q .GroupBy("Time") .Select("new (Select(I).Where(it != null).Average() as q)") .ToDynamicArray(); // Assert resultDynamic.Should().BeEquivalentTo(result); } [Fact] public void GroupBy_Dynamic_SelectWhereAverageWithSelector() { // Arrange var q = new[] { new DataSetA { I = 5 }, new DataSetA { I = 7 } } .AsQueryable(); // Act var result = q .GroupBy(x => x.Time) .Select(x => new { q = x.Select(d => d).Average(y => y.I) }) .ToArray(); var resultDynamic = q .GroupBy("Time") .Select("new (Select(it).Average(I) as q)") .ToDynamicArray(); // Assert resultDynamic.Should().BeEquivalentTo(result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.GroupBy.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
1,913
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; #else using System.Data.Entity; #endif using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { /// <summary> /// Test for path_to_url /// </summary> [Fact] public void Entities_Where_In_And() { // Arrange var expected = _context.Blogs.Include(b => b.Posts).Where(b => new[] { 1000, 1001, 1002 }.Contains(b.BlogId) && new[] { "Blog1", "Blog2" }.Contains(b.Name)).ToArray(); // Act var test = _context.Blogs.Include(b => b.Posts).Where(@"BlogId in (1000, 1001, 1002) and Name in (""Blog1"", ""Blog2"")").ToArray(); // Assert Assert.Equal(expected, test); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.In.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
197
```smalltalk using System.Collections.Generic; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class QueryableTests { [Fact] public void Average() { // Arrange var incomes = User.GenerateSampleModels(100).Select(u => u.Income).ToArray(); // Act var expected = incomes.Average(); var actual = incomes.AsQueryable().Average(); // Assert Assert.Equal(expected, actual); } [Fact] public void Average_Nullable() { // Arrange var list = new List<Entity> { new Entity { Value = 1 }, new Entity { Value = 2 }, new Entity { Value = null } }; var queryable = list.AsQueryable(); // Act var expected = queryable.Average(p => p.Value); var actual = queryable.Average("Value"); // Assert Assert.Equal(expected, actual); } [Fact] public void Average_Selector() { // Arrange var users = User.GenerateSampleModels(100); // Act var expected = users.Average(u => u.Income); var result = users.AsQueryable().Average("Income"); // Assert Assert.Equal(expected, result); } public class Entity { public int? Value { get; set; } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Average.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
294
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using System.Threading.Tasks; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public async Task Entities_AllAsync() { // Arrange var expected = await _context.Blogs.AllAsync(b => b.BlogId > 2000); // Act var actual = await _context.Blogs.AllAsync("BlogId > 2000"); // Assert Assert.Equal(expected, actual); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.AllAsync.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
132
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Single() { //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var result = testListQry.Take(1).Single(); //Assert #if NET35 Assert.Equal(testList[0].Id, result.GetDynamicProperty<Guid>("Id")); #else Assert.Equal(testList[0].Id, result.Id); #endif } [Fact] public void Single_Predicate() { //Arrange var testList = User.GenerateSampleModels(100); var testListQry = testList.AsQueryable(); //Act var expected = testListQry.Single(u => u.UserName == "User4"); var result = testListQry.Single("UserName == \"User4\""); //Assert Assert.Equal(expected as object, result); } [Fact] public void SingleOrDefault() { //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var singleResult = testListQry.Take(1).SingleOrDefault(); var defaultResult = ((IQueryable)Enumerable.Empty<User>().AsQueryable()).SingleOrDefault(); //Assert #if NET35 Assert.Equal(testList[0].Id, singleResult.GetDynamicProperty<Guid>("Id")); #else Assert.Equal(testList[0].Id, singleResult.Id); #endif Assert.Null(defaultResult); } [Fact] public void SingleOrDefault_Predicate() { //Arrange var testList = User.GenerateSampleModels(100); var testListQry = testList.AsQueryable(); //Act var expected = testListQry.SingleOrDefault(u => u.UserName == "User4"); var result = testListQry.SingleOrDefault("UserName == \"User4\""); //Assert Assert.Equal(expected as object, result); } [Fact] public void Single_Dynamic() { //Arrange var testList = User.GenerateSampleModels(1); while (testList[0].Roles.Count > 1) testList[0].Roles.RemoveAt(0); IQueryable testListQry = testList.AsQueryable(); //Act dynamic realResult = testList.OrderBy(x => x.Roles.Single().Name).Select(x => x.Id).ToArray(); var testResult = testListQry.OrderBy("Roles.Single().Name").Select("Id"); //Assert Assert.Equal(realResult, testResult.Cast<Guid>().ToArray()); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Single.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
589
```smalltalk using NFluent; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public class ParsingConfigTests { class TestQueryableAnalyzer : IQueryableAnalyzer { public bool SupportsLinqToObjects(IQueryable query, IQueryProvider provider) { return true; } } [Fact] public void ParsingConfig_QueryableAnalyzer_Set_Null() { // Assign var config = ParsingConfig.Default; // Act config.QueryableAnalyzer = null; // Assert Check.That(config.QueryableAnalyzer).IsNotNull(); } [Fact] public void ParsingConfig_QueryableAnalyzer_Set_Custom() { // Assign var config = ParsingConfig.Default; var analyzer = new TestQueryableAnalyzer(); // Act config.QueryableAnalyzer = analyzer; // Assert Check.That(config.QueryableAnalyzer).IsEqualTo(analyzer); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/ParsingConfigTests.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
194
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void TakeWhile_Predicate() { //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var expected = testList.TakeWhile(u => u.Income > 1000); var result = testListQry.TakeWhile("Income > 1000"); //Assert Assert.Equal(expected.ToArray(), result.Cast<User>().ToArray()); } [Fact] public void TakeWhile_Predicate_Args() { const int income = 1000; //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var expected = testList.TakeWhile(u => u.Income > income); var result = testListQry.TakeWhile("Income > @0", income); //Assert Assert.Equal(expected.ToArray(), result.Cast<User>().ToArray()); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.TakeWhile.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
242
```smalltalk namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
22
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using System.Linq.Expressions; using System.Threading.Tasks; using System.Linq.Dynamic.Core.Tests.Helpers.Entities; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public async Task Entities_CountAsync_Predicate_Args() { // Arrange const string search = "a"; Expression<Func<Blog, bool>> predicate = b => b.Name.Contains(search); #if EFCORE var expected = await EntityFrameworkQueryableExtensions.CountAsync(_context.Blogs, predicate); #else var expected = await QueryableExtensions.CountAsync(_context.Blogs, predicate); #endif //Act int result = await (_context.Blogs as IQueryable).CountAsync("Name.Contains(@0)", search); //Assert Assert.Equal(expected, result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.CountAsync.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
200
```smalltalk using System.Collections.Generic; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class QueryableTests { [Fact] public void Contains_Dynamic_ListWithStrings() { // Arrange var baseQuery = User.GenerateSampleModels(100).AsQueryable(); var list = new List<string> { "User1", "User5", "User10" }; // Act var realQuery = baseQuery.Where(x => list.Contains(x.UserName)).Select(x => x.Id); var testQuery = baseQuery.Where("@0.Contains(UserName)", list).Select("Id"); // Assert Assert.Equal(realQuery.ToArray(), testQuery.Cast<Guid>().ToArray()); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Contains.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
156
```smalltalk using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_Count_Predicate() { // Arrange const string search = "a"; // Act int expected = _context.Blogs.Count(b => b.Name.Contains(search)); int result = _context.Blogs.Count("Name.Contains(@0)", search); // Assert Assert.Equal(expected, result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Count.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
96
```smalltalk using System.Collections.Generic; using FluentAssertions; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Concat_Dynamic_ListOfStrings() { // Arrange var list1 = new List<bool> { true }; var list2 = new List<string> { "User3", "User4" }; var list3 = new List<string> { "User5", "User6", "User7" }; // Act var testQuery = list1.AsQueryable().Select("@0.Concat(@1).ToList()", list2, list3); // Assert var result = testQuery.ToDynamicArray<List<string>>(); result.First().Should().BeEquivalentTo(list2.Concat(list3)); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Concat.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
170
```xml <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0"> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> <AssemblyName>System.Linq.Dynamic.Core.Tests</AssemblyName> <DebugType>full</DebugType> <SignAssembly>True</SignAssembly> <AssemblyOriginatorKeyFile>../../src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.snk</AssemblyOriginatorKeyFile> <IsPackable>false</IsPackable> <DefineConstants>$(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1;AspNetCoreIdentity</DefineConstants> </PropertyGroup> <ItemGroup> <PackageReference Include="coverlet.msbuild" Version="6.0.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <PackageReference Include="coverlet.collector" Version="6.0.2"> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <PrivateAssets>all</PrivateAssets> </PackageReference> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> <PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <PrivateAssets>all</PrivateAssets> </PackageReference> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Linq.PropertyTranslator.Core" Version="1.0.5" /> <PackageReference Include="QueryInterceptor.Core" Version="1.0.9" /> <PackageReference Include="NFluent" Version="2.8.0" /> <PackageReference Include="Moq" Version="4.18.2" /> <PackageReference Include="FluentAssertions" Version="6.8.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" /> <PackageReference Include="LinqKit.Microsoft.EntityFrameworkCore" Version="8.1.5" /> <PackageReference Include="NodaTime" Version="3.1.5" /> <PackageReference Include="Testcontainers.MsSql" Version="3.9.0" /> <ProjectReference Include="..\..\src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj" /> </ItemGroup> </Project> ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/System.Linq.Dynamic.Core.Tests.csproj
xml
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
662
```smalltalk using System.Collections.Generic; using System.Dynamic; using System.Globalization; using System.Linq.Dynamic.Core.CustomTypeProviders; using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Helpers; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using FluentAssertions; using Moq; using Newtonsoft.Json.Linq; using NFluent; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public enum TestEnumPublic : sbyte { Var1 = 0, Var2 = 1, Var3 = 2, Var4 = 4, Var5 = 8, Var6 = 16 } public partial class ExpressionTests { public enum TestEnum2 : sbyte { Var1 = 0, Var2 = 1, Var3 = 2, Var4 = 4, Var5 = 8, Var6 = 16 } public class TestEnumClass { public TestEnum A { get; set; } public TestEnum2 B { get; set; } public TestEnum2? C { get; set; } public TestEnumPublic E { get; set; } public int Id { get; set; } } public class TestGuidNullClass { public Guid? GuidNull { get; set; } public Guid GuidNormal { get; set; } public int Id { get; set; } } public class TestObjectIdClass { public int Id { get; set; } public long ObjectId { get; set; } } public class Foo { public Foo FooValue { get; set; } public string Zero() => null; public string One(int x) => null; public string Two(int x, int y) => null; } public class SourceClass { public int A { get; set; } } public class TargetClass { public TestEnum A { get; set; } } [Fact] public void ExpressionTests_AndAlso() { // Arrange var users = new[] { new User { Income = 1 }, new User { Income = 2 }, new User { Income = 3 } }.AsQueryable(); // Act var result = users.Where(u => u.Income == 1 && u.Income == 2).ToArray(); var resultDynamic = users.Where("Income == 1 AndAlso Income == 2").ToArray(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void ExpressionTests_ArrayInitializer() { // Arrange var list = new[] { 0, 1, 2, 3, 4 }; // Act var result1 = list.AsQueryable().SelectMany("new[] {}"); var result2 = list.AsQueryable().SelectMany("new[] { it + 1, it + 2 }"); var result3 = list.AsQueryable().SelectMany("new long[] { it + 1, byte(it + 2), short(it + 3) }"); var result4 = list.AsQueryable().SelectMany("new[] { new[] { it + 1, it + 2 }, new[] { it + 3, it + 4 } }"); // Assert Assert.Equal(0, result1.Count()); Assert.Equal(result2.Cast<int>(), list.SelectMany(item => new[] { item + 1, item + 2 })); Assert.Equal(result3.Cast<long>(), list.SelectMany(item => new long[] { item + 1, (byte)(item + 2), (short)(item + 3) })); Assert.Equal(result4.SelectMany("it").Cast<int>(), list.SelectMany(item => new[] { new[] { item + 1, item + 2 }, new[] { item + 3, item + 4 } }).SelectMany(item => item)); Assert.Throws<ParseException>(() => list.AsQueryable().SelectMany("new[ {}")); Assert.Throws<ParseException>(() => list.AsQueryable().SelectMany("new] {}")); } [Fact] public void ExpressionTests_BinaryAndNumericConvert() { // Arrange var lst = new List<TestEnumClass> { new TestEnumClass {A = TestEnum.Var3, B = TestEnum2.Var3, Id = 1}, new TestEnumClass {A = TestEnum.Var4, B = TestEnum2.Var4, Id = 2}, new TestEnumClass {A = TestEnum.Var2, B = TestEnum2.Var2, Id = 3} }; var qry = lst.AsQueryable(); // Act var result0 = qry.FirstOrDefault("(it.A & @0) == 1", 1); var result1 = qry.FirstOrDefault("(it.A & @0) == 1", (uint)1); var result2 = qry.FirstOrDefault("(it.A & @0) == 1", (long)1); var result3 = qry.FirstOrDefault("(it.A & @0) == 1", (ulong)1); var result4 = qry.FirstOrDefault("(it.A & @0) == 1", (byte)1); var result5 = qry.FirstOrDefault("(it.A & @0) == 1", (sbyte)1); var result6 = qry.FirstOrDefault("(it.A & @0) == 1", (ushort)1); var result7 = qry.FirstOrDefault("(it.A & @0) == 1", (short)1); var result10 = qry.FirstOrDefault("(it.B & @0) == 1", 1); var result11 = qry.FirstOrDefault("(it.B & @0) == 1", (uint)1); var result12 = qry.FirstOrDefault("(it.B & @0) == 1", (long)1); var result13 = qry.FirstOrDefault("(it.B & @0) == 1", (ulong)1); var result14 = qry.FirstOrDefault("(it.B & @0) == 1", (byte)1); var result15 = qry.FirstOrDefault("(it.B & @0) == 1", (sbyte)1); var result16 = qry.FirstOrDefault("(it.B & @0) == 1", (ushort)1); var result17 = qry.FirstOrDefault("(it.B & @0) == 1", (short)1); // Assert Assert.Equal(3, result0.Id); Assert.Equal(3, result1.Id); Assert.Equal(3, result2.Id); Assert.Equal(3, result3.Id); Assert.Equal(3, result4.Id); Assert.Equal(3, result5.Id); Assert.Equal(3, result6.Id); Assert.Equal(3, result7.Id); Assert.Equal(3, result10.Id); Assert.Equal(3, result11.Id); Assert.Equal(3, result12.Id); Assert.Equal(3, result13.Id); Assert.Equal(3, result14.Id); Assert.Equal(3, result15.Id); Assert.Equal(3, result16.Id); Assert.Equal(3, result17.Id); } [Fact] public void ExpressionTests_BinaryOrNumericConvert() { // Arrange var lst = new List<TestEnumClass> { new TestEnumClass {A = TestEnum.Var3, B = TestEnum2.Var3, Id = 1}, new TestEnumClass {A = TestEnum.Var4, B = TestEnum2.Var4, Id = 2}, new TestEnumClass {A = TestEnum.Var2, B = TestEnum2.Var2, Id = 3} }; var qry = lst.AsQueryable(); // Act var result0 = qry.FirstOrDefault("(it.A | @0) == 1", 1); var result1 = qry.FirstOrDefault("(it.A | @0) == 1", (uint)1); var result2 = qry.FirstOrDefault("(it.A | @0) == 1", (long)1); var result3 = qry.FirstOrDefault("(it.A | @0) == 1", (ulong)1); var result4 = qry.FirstOrDefault("(it.A | @0) == 1", (byte)1); var result5 = qry.FirstOrDefault("(it.A | @0) == 1", (sbyte)1); var result6 = qry.FirstOrDefault("(it.A | @0) == 1", (ushort)1); var result7 = qry.FirstOrDefault("(it.A | @0) == 1", (short)1); var result10 = qry.FirstOrDefault("(it.B | @0) == 1", 1); var result11 = qry.FirstOrDefault("(it.B | @0) == 1", (uint)1); var result12 = qry.FirstOrDefault("(it.B | @0) == 1", (long)1); var result13 = qry.FirstOrDefault("(it.B | @0) == 1", (ulong)1); var result14 = qry.FirstOrDefault("(it.B | @0) == 1", (byte)1); var result15 = qry.FirstOrDefault("(it.B | @0) == 1", (sbyte)1); var result16 = qry.FirstOrDefault("(it.B | @0) == 1", (ushort)1); var result17 = qry.FirstOrDefault("(it.B | @0) == 1", (short)1); // Assert Assert.Equal(3, result0.Id); Assert.Equal(3, result1.Id); Assert.Equal(3, result2.Id); Assert.Equal(3, result3.Id); Assert.Equal(3, result4.Id); Assert.Equal(3, result5.Id); Assert.Equal(3, result6.Id); Assert.Equal(3, result7.Id); Assert.Equal(3, result10.Id); Assert.Equal(3, result11.Id); Assert.Equal(3, result12.Id); Assert.Equal(3, result13.Id); Assert.Equal(3, result14.Id); Assert.Equal(3, result15.Id); Assert.Equal(3, result16.Id); Assert.Equal(3, result17.Id); } [Fact] public void ExpressionTests_Cast_To_NullableInt() { // Arrange var list = new List<SimpleValuesModel> { new SimpleValuesModel { IntValue = 5 } }; // Act var expectedResult = list.Select(x => (int?)x.IntValue); var result = list.AsQueryable().Select("int?(IntValue)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<int?>()); } [Fact] public void ExpressionTests_Cast_To_Enum_Using_DynamicLinqType() { // Arrange var list = new List<SimpleValuesModel> { new SimpleValuesModel { EnumValueDynamicLinqType = SimpleValuesModelEnumAsDynamicLinqType.A } }; // Act var expectedResult = list.Select(x => x.EnumValueDynamicLinqType); var result = list.AsQueryable().Select("SimpleValuesModelEnumAsDynamicLinqType(EnumValueDynamicLinqType)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<SimpleValuesModelEnumAsDynamicLinqType>()); } [Fact] public void ExpressionTests_Cast_To_FullTypeDateTime_Using_DynamicLinqType() { // Arrange var config = new ParsingConfig { PrioritizePropertyOrFieldOverTheType = true }; var list = new List<SimpleValuesModel> { new SimpleValuesModel { DateTime = DateTime.Now } }; // Act var expectedResult = list.Select(x => x.DateTime); var result = list.AsQueryable().Select(config, $"\"{typeof(DateTime).FullName}\"(DateTime)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<DateTime>()); } [Fact] public void your_sha256_hashnqType() { // Arrange var config = new ParsingConfig { PrioritizePropertyOrFieldOverTheType = true }; var list = new List<SimpleValuesModel> { new SimpleValuesModel { DateTime = DateTime.Now } }; // Act var expectedResult = list.Select(x => (DateTime?)x.DateTime); var result = list.AsQueryable().Select(config, $"\"{typeof(DateTime).FullName}\"?(DateTime)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<DateTime?>()); } [Fact] public void ExpressionTests_Cast_To_FullTypeEnum_Using_DynamicLinqType() { // Arrange var list = new List<SimpleValuesModel> { new SimpleValuesModel { EnumValueDynamicLinqType = SimpleValuesModelEnumAsDynamicLinqType.A } }; // Act var expectedResult = list.Select(x => x.EnumValueDynamicLinqType); var result = list.AsQueryable().Select($"\"{typeof(SimpleValuesModelEnumAsDynamicLinqType).FullName}\"(EnumValueDynamicLinqType)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<SimpleValuesModelEnumAsDynamicLinqType>()); } [Fact] public void your_sha256_hashpe() { // Arrange var list = new List<SimpleValuesModel> { new SimpleValuesModel { EnumValueDynamicLinqType = SimpleValuesModelEnumAsDynamicLinqType.A } }; // Act var expectedResult = list.Select(x => (SimpleValuesModelEnumAsDynamicLinqType?)x.EnumValueDynamicLinqType); var result = list.AsQueryable().Select($"\"{typeof(SimpleValuesModelEnumAsDynamicLinqType).FullName}\"?(EnumValueDynamicLinqType)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<SimpleValuesModelEnumAsDynamicLinqType?>()); } [Fact] public void ExpressionTests_Cast_To_Enum_Using_CustomTypeProvider() { // Arrange var dynamicLinqCustomTypeProviderMock = new Mock<IDynamicLinkCustomTypeProvider>(); dynamicLinqCustomTypeProviderMock.Setup(d => d.GetCustomTypes()).Returns(new HashSet<Type> { typeof(SimpleValuesModelEnum) }); var config = new ParsingConfig { CustomTypeProvider = dynamicLinqCustomTypeProviderMock.Object }; var list = new List<SimpleValuesModel> { new SimpleValuesModel { EnumValue = SimpleValuesModelEnum.A } }; // Act var expectedResult = list.Select(x => x.EnumValue); var result = list.AsQueryable().Select(config, "SimpleValuesModelEnum(EnumValue)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<SimpleValuesModelEnum>()); } [Fact] public void ExpressionTests_Cast_To_NullableEnum_Using_DynamicLinqType() { // Arrange var list = new List<SimpleValuesModel> { new SimpleValuesModel { EnumValueDynamicLinqType = SimpleValuesModelEnumAsDynamicLinqType.A } }; // Act var expectedResult = list.Select(x => (SimpleValuesModelEnumAsDynamicLinqType?)x.EnumValueDynamicLinqType); var result = list.AsQueryable().Select("SimpleValuesModelEnumAsDynamicLinqType?(EnumValueDynamicLinqType)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<SimpleValuesModelEnumAsDynamicLinqType?>()); } [Fact] public void ExpressionTests_Cast_To_NullableEnum_Using_CustomTypeProvider() { // Arrange var dynamicLinqCustomTypeProviderMock = new Mock<IDynamicLinkCustomTypeProvider>(); dynamicLinqCustomTypeProviderMock.Setup(d => d.GetCustomTypes()).Returns(new HashSet<Type> { typeof(SimpleValuesModelEnum), typeof(SimpleValuesModelEnum?) }); var config = new ParsingConfig { CustomTypeProvider = dynamicLinqCustomTypeProviderMock.Object }; var list = new List<SimpleValuesModel> { new SimpleValuesModel { EnumValue = SimpleValuesModelEnum.A } }; // Act var expectedResult = list.Select(x => (SimpleValuesModelEnum?)x.EnumValue); var result = list.AsQueryable().Select(config, $"SimpleValuesModelEnum?(EnumValue)"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<SimpleValuesModelEnum?>()); } [Fact] public void ExpressionTests_Cast_Automatic_To_NullableLong() { // Arrange var q = new[] { null, new UserProfile(), new UserProfile { UserProfileDetails = new UserProfileDetails { Id = 42 } } }.AsQueryable(); // Act var expectedResult = q.Select(x => x != null && x.UserProfileDetails != null ? (long?)x.UserProfileDetails.Id : null); var result = q.Select("it != null && it.UserProfileDetails != null ? it.UserProfileDetails.Id : null"); // Assert Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<long?>()); } [Fact] public void ExpressionTests_Cast_To_NewNullableInt() { // Arrange var list = new List<SimpleValuesModel> { new SimpleValuesModel { IntValue = 5 } }; // Act var expectedResult = list.Select(x => new { i = (int?)x.IntValue }); var result = list.AsQueryable().Select("new (int?(IntValue) as i)"); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void ExpressionTests_Conditional_With_Automatic_Cast_NullableInt() { // Arrange var qry = new[] { 1, 2 }.AsQueryable(); // Act var realResult1 = qry.Select(x => x == 2 ? null : (int?)x).ToList(); var result1 = qry.Select("it == 2 ? null : it").ToDynamicList<int?>(); var realResult2 = qry.Select(x => x == 2 ? (int?)x : null).ToList(); var result2 = qry.Select("it == 2 ? it : null").ToDynamicList<int?>(); // Assert Check.That(result1).ContainsExactly(realResult1); Check.That(result2).ContainsExactly(realResult2); } [Fact] public void ExpressionTests_Conditional_With_No_Automatic_Cast() { // Arrange var qry = new[] { null, new SimpleValuesModel() }.AsQueryable(); // Act var realResult1 = qry.Select(x => x != null ? x : null).ToList(); var result1 = qry.Select("it != null ? it : null").ToDynamicList<SimpleValuesModel>(); var realResult2 = qry.Select(x => x == null ? null : x).ToList(); var result2 = qry.Select("it == null ? null : it").ToDynamicList<SimpleValuesModel>(); // Assert Check.That(result1).ContainsExactly(realResult1); Check.That(result2).ContainsExactly(realResult2); } [Fact] public void ExpressionTests_Conditional() { // Arrange int[] values = { 1, 2, 3, 4, 5 }; var qry = values.AsQueryable(); // Act var realResult = values.Select(x => x == 2 ? 99 : 100).ToList(); var result = qry.Select("it == 2 ? 99 : 100").ToDynamicList<int>(); // Assert Check.That(result).ContainsExactly(realResult); } [Fact] public void ExpressionTests_ConditionalOr1() { // Arrange int[] values = { 1, 2, 3, 4, 5 }; var qry = values.AsQueryable(); // Act var realResult = values.Where(x => x == 2 || x == 3).ToList(); var result = qry.Where("it == 2 or it == 3").ToDynamicList<int>(); // Assert Check.That(realResult).ContainsExactly(result); } [Fact] public void ExpressionTests_ConditionalOr2() { // Arrange int[] values = { 1, 2, 3, 4, 5 }; var qry = values.AsQueryable(); // Act var realResult = values.Where(x => x == 2 || x == 3).ToList(); var result = qry.Where("it == 2 || it == 3").ToDynamicList<int>(); // Assert Check.That(realResult).ContainsExactly(result); } [Fact] public void ExpressionTests_ConditionalAnd1() { // Arrange var values = new[] { new { s = "s", i = 1 }, new { s = "abc", i = 2 } }; var qry = values.AsQueryable(); // Act var realResult = values.Where(x => x.s == "s" && x.i == 2).ToList(); var result = qry.Where("s == \"s\" and i == 2").ToDynamicList(); // Assert Check.That(realResult).ContainsExactly(result); } [Fact] public void ExpressionTests_ConditionalAnd2() { // Arrange var values = new[] { new { s = "s", i = 1 }, new { s = "abc", i = 2 } }; var qry = values.AsQueryable(); // Act var realResult = values.Where(x => x.s == "s" && x.i == 2).ToList(); var result = qry.Where("s == \"s\" && i == 2").ToDynamicList(); // Assert Check.That(realResult).ContainsExactly(result); } [Fact] public void ExpressionTests_ContainsGuid() { // Arrange var userList = User.GenerateSampleModels(5); var userQry = userList.AsQueryable(); var failValues = new List<Guid> { new Guid("{22222222-7651-4045-962A-3D44DEE71398}"), new Guid("{33333333-8F80-4497-9125-C96DEE23037D}"), new Guid("{44444444-E32D-4DE1-8F1C-A144C2B0424D}") }; var successValues = failValues.Concat(new[] { userList[0].Id }).ToArray(); // Act var found1 = userQry.Where("Id in @0", successValues); var found2 = userQry.Where("@0.Contains(Id)", successValues); var notFound1 = userQry.Where("Id in @0", failValues); var notFound2 = userQry.Where("@0.Contains(Id)", failValues); // Assert #if NET35 Assert.Equal(userList[0].Id, ((User)found1.Single()).Id); Assert.Equal(userList[0].Id, ((User)found2.Single()).Id); #else Assert.Equal(userList[0].Id, found1.Single().Id); Assert.Equal(userList[0].Id, found2.Single().Id); #endif Assert.False(notFound1.Any()); Assert.False(notFound2.Any()); } [Fact] public void ExpressionTests_DateTimeString() { // Arrange var lst = new List<DateTime> { DateTime.Today, DateTime.Today.AddDays(1), DateTime.Today.AddDays(2) }; var qry = lst.AsQueryable(); // Act var testValue = lst[0].ToString(CultureInfo.InvariantCulture); var result1 = qry.Where("it = @0", testValue); var result2 = qry.Where("@0 = it", testValue); // Assert Assert.Equal(lst[0], result1.Single()); Assert.Equal(lst[0], result2.Single()); } #if NET6_0_OR_GREATER [Fact] public void ExpressionTests_DateOnlyString() { // Arrange var now = new DateTime(2023, 2, 10, 12, 13, 14); var lst = new List<DateOnly> { DateOnly.FromDateTime(now), DateOnly.FromDateTime(now.AddDays(1)), DateOnly.FromDateTime(now.AddDays(2)) }; var qry = lst.AsQueryable(); // Act var testValue = lst[0].ToString(CultureInfo.InvariantCulture); var result1 = qry.Where("it = @0", testValue); var result2 = qry.Where("@0 = it", testValue); // Assert Assert.Equal(lst[0], result1.Single()); Assert.Equal(lst[0], result2.Single()); } [Fact] public void ExpressionTests_TimeOnlyString() { // Arrange var now = new DateTime(2023, 2, 10, 12, 13, 14); var lst = new List<TimeOnly> { TimeOnly.FromDateTime(now), TimeOnly.FromDateTime(now.AddSeconds(1)), TimeOnly.FromDateTime(now.AddSeconds(2)) }; var qry = lst.AsQueryable(); // Act var testValue = "12:13:14"; var result1 = qry.Where("it = @0", testValue); var result2 = qry.Where("@0 = it", testValue); // Assert Assert.Equal(lst[0], result1.Single()); Assert.Equal(lst[0], result2.Single()); } #endif [Fact] public void ExpressionTests_DecimalQualifiers() { // Arrange var values = new[] { 1m, 2M, 3M }.AsQueryable(); var resultValues = new[] { 2m, 3m }.AsQueryable(); // Act var result1 = values.Where("it == 2M or it == 3m"); var result2 = values.Where("it == 2.0M or it == 3.00m"); // Assert Assert.Equal(resultValues.ToArray(), result1.ToArray()); Assert.Equal(resultValues.ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_DecimalQualifiers_Negative() { // Arrange var values = new[] { -1m, -2M, -3M }.AsQueryable(); var resultValues = new[] { -2m, -3m }.AsQueryable(); // Act var result1 = values.Where("it == -2M or it == -3m"); var result2 = values.Where("it == -2.0M or it == -3.0m"); // Assert Assert.Equal(resultValues.ToArray(), result1.ToArray()); Assert.Equal(resultValues.ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_DistinctBy() { // Arrange //Makes a Distinct By Tuple.Item1 but returns a full Tuple var lst = new List<Tuple<int, int, int>> { new Tuple<int, int, int>(1, 1, 1), new Tuple<int, int, int>(1, 1, 2), new Tuple<int, int, int>(1, 1, 3), new Tuple<int, int, int>(2, 2, 4), new Tuple<int, int, int>(2, 2, 5), new Tuple<int, int, int>(2, 2, 6), new Tuple<int, int, int>(2, 3, 7) }; var p = lst.AsQueryable() as IQueryable; var qry = p.GroupBy("Item1", "it").Select("it.Max(it.Item3)"); // Act var qry1 = p.Where("@0.Any(it == parent.Item3)", qry); var qry2 = p.Where("@0.Any($ == ^.Item3)", qry); var qry3 = p.Where("@0.Any($ == ~.Item3)", qry); // Assert Assert.Equal(2, qry1.Count()); Assert.Equal(2, qry2.Count()); Assert.Equal(2, qry3.Count()); } [Fact] public void ExpressionTests_Divide_Number() { // Arrange var values = new[] { -10, 20 }.AsQueryable(); // Act var result = values.Select<int>("it / 10"); var expected = values.Select(i => i / 10); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void ExpressionTests_Double() { // Arrange var values = new[] { 1d, 2D, 3d }.AsQueryable(); var resultValues = new[] { 2d, 3d }.AsQueryable(); // Act var result1 = values.Where("it == 2 or it == 3"); var result2 = values.Where("it > 1.99"); // Assert Assert.Equal(resultValues.ToArray(), result1.ToArray()); Assert.Equal(resultValues.ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_Double_Negative() { // Arrange var values = new[] { -1d, -2D, -3d }.AsQueryable(); var resultValues = new[] { -2d, -3d }.AsQueryable(); // Act var result1 = values.Where("it == -2 or it == -3"); var result2 = values.Where("it == -2.00 or it == -3.0"); // Assert Assert.Equal(resultValues.ToArray(), result1.ToArray()); Assert.Equal(resultValues.ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_DoubleQualifiers() { // Arrange var values = new[] { 1d, 2D, 3d, -10d }.AsQueryable(); var resultValues = new[] { 2d, 3d, -10d }.AsQueryable(); // Act var result1 = values.Where("it == 2d or it == 3D or it == -10d"); var result2 = values.Where("it == 2.00d or it == 3.0D or it == -10.000D"); // Assert Assert.Equal(resultValues.ToArray(), result1.ToArray()); Assert.Equal(resultValues.ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_DoubleQualifiers_Negative() { // Arrange var values = new[] { -1d, -2D, -3d }.AsQueryable(); var resultValues = new[] { -2d, -3d }.AsQueryable(); // Act var result1 = values.Where("it == -2d or it == -3D"); var result2 = values.Where("it == -2.00d or it == -3.0D"); // Assert Assert.Equal(resultValues.ToArray(), result1.ToArray()); Assert.Equal(resultValues.ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_Enum_Cast_Int_To_Enum() { // Arrange var enumvalue = TestEnum.Var1; var qry = new List<SourceClass> { new SourceClass { A = (int)enumvalue } }.AsQueryable(); // Act var result = qry.Select<TargetClass>("new(A)").ToArray(); // Assert result.Should().ContainEquivalentOf(new TargetClass { A = enumvalue }); } [Fact] public void ExpressionTests_Enum() { var config = new ParsingConfig(); // Arrange var lst = new List<TestEnum> { TestEnum.Var1, TestEnum.Var2, TestEnum.Var3, TestEnum.Var4, TestEnum.Var5, TestEnum.Var6 }; var qry = lst.AsQueryable(); // Act var resultLessThan = qry.Where(config, "it < TestEnum.Var4"); var resultLessThanEqual = qry.Where(config, "it <= TestEnum.Var4"); var resultGreaterThan = qry.Where(config, "TestEnum.Var4 > it"); var resultGreaterThanEqual = qry.Where(config, "TestEnum.Var4 >= it"); var resultEqualItLeft = qry.Where(config, "it = Var5"); var resultEqualItRight = qry.Where(config, "Var5 = it"); var resultEqualEnumParamLeft = qry.Where("@0 = it", TestEnum.Var5); var resultEqualEnumParamRight = qry.Where("it = @0", TestEnum.Var5); var resultEqualIntParamLeft = qry.Where("@0 = it", 8); var resultEqualIntParamRight = qry.Where("it = @0", 8); var resultEqualStringParamRight = qry.Where(config, "it = @0", "Var5"); var resultEqualStringParamLeft = qry.Where(config, "@0 = it", "Var5"); var resultEqualStringMixedCaseParamLeft = qry.Where(config, "@0 = it", "vAR5"); var resultEqualStringMixedCaseParamRight = qry.Where(config, "it = @0", "vAR5"); // Assert Check.That(resultLessThan.ToArray()).ContainsExactly(TestEnum.Var1, TestEnum.Var2, TestEnum.Var3); Check.That(resultLessThanEqual.ToArray()).ContainsExactly(TestEnum.Var1, TestEnum.Var2, TestEnum.Var3, TestEnum.Var4); Check.That(resultGreaterThan.ToArray()).ContainsExactly(TestEnum.Var1, TestEnum.Var2, TestEnum.Var3); Check.That(resultGreaterThanEqual.ToArray()).ContainsExactly(TestEnum.Var1, TestEnum.Var2, TestEnum.Var3, TestEnum.Var4); Check.That(resultEqualItLeft.Single()).Equals(TestEnum.Var5); Check.That(resultEqualItRight.Single()).Equals(TestEnum.Var5); Check.That(resultEqualEnumParamLeft.Single()).Equals(TestEnum.Var5); Check.That(resultEqualEnumParamRight.Single()).Equals(TestEnum.Var5); Check.That(resultEqualIntParamLeft.Single()).Equals(TestEnum.Var5); Check.That(resultEqualIntParamRight.Single()).Equals(TestEnum.Var5); Check.That(resultEqualStringParamLeft.Single()).Equals(TestEnum.Var5); Check.That(resultEqualStringParamRight.Single()).Equals(TestEnum.Var5); Check.That(resultEqualStringMixedCaseParamLeft.Single()).Equals(TestEnum.Var5); Check.That(resultEqualStringMixedCaseParamRight.Single()).Equals(TestEnum.Var5); } [Fact] public void ExpressionTests_Enum_Property_Equality_Using_Argument() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { B = TestEnum2.Var2 } }.AsQueryable(); // Act var resultEqualEnumParamLeft = qry.Where("@0 == it.B", TestEnum2.Var2).ToDynamicArray(); var resultEqualEnumParamRight = qry.Where("it.B == @0", TestEnum2.Var2).ToDynamicArray(); var resultEqualIntParamLeft = qry.Where("@0 == it.B", 1).ToDynamicArray(); var resultEqualIntParamRight = qry.Where("it.B == @0", 1).ToDynamicArray(); var resultEqualDecimalParamLeft = qry.Where("@0 == it.B", 1m).ToDynamicArray(); var resultEqualDecimalParamRight = qry.Where("it.B == @0", 1m).ToDynamicArray(); var resultEqualDoubleParamLeft = qry.Where("@0 == it.B", 1.0).ToDynamicArray(); var resultEqualDoubleParamRight = qry.Where("it.B == @0", 1.0).ToDynamicArray(); // Assert Check.That(resultEqualEnumParamLeft.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualEnumParamRight.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualIntParamLeft.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualIntParamRight.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualDecimalParamLeft.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualDecimalParamRight.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualDoubleParamLeft.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualDoubleParamRight.Single()).Equals(TestEnum2.Var2); } [Fact] public void ExpressionTests_Enum_Property_Equality_With_Integer_Inline() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { E = TestEnumPublic.Var2 } }.AsQueryable(); // Act var resultEqualIntParamLeft = qry.Where("1 == it.E").ToDynamicArray(); var resultEqualIntParamRight = qry.Where("it.E == 1").ToDynamicArray(); // Assert Check.That(resultEqualIntParamLeft.Single()).Equals(TestEnumPublic.Var2); Check.That(resultEqualIntParamRight.Single()).Equals(TestEnumPublic.Var2); } [Fact] public void your_sha256_hashName_Inline() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { E = TestEnumPublic.Var2 } }.AsQueryable(); string enumType = typeof(TestEnumPublic).FullName!; // Act var resultEqualEnumParamLeft = qry.Where($"{enumType}.Var2 == it.E").ToDynamicArray(); var resultEqualEnumParamRight = qry.Where($"it.E == {enumType}.Var2").ToDynamicArray(); // Assert Check.That(resultEqualEnumParamLeft.Single()).Equals(TestEnumPublic.Var2); Check.That(resultEqualEnumParamRight.Single()).Equals(TestEnumPublic.Var2); } [Fact] public void your_sha256_hashnline() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { B = TestEnum2.Var2 } }.AsQueryable(); string enumType = typeof(TestEnum2).FullName!; // Act var resultEqualEnumParamLeft = qry.Where($"{enumType}.Var2 == it.B").ToDynamicArray(); var resultEqualEnumParamRight = qry.Where($"it.B == {enumType}.Var2").ToDynamicArray(); // Assert Check.That(resultEqualEnumParamLeft.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualEnumParamRight.Single()).Equals(TestEnum2.Var2); } [Fact] public void your_sha256_hashine() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { E = TestEnumPublic.Var2 } }.AsQueryable(); string enumType = typeof(TestEnumPublic).FullName!; // Act var resultEqualEnumParamLeft = qry.Where($"{enumType}.Var2 == it.E").ToDynamicArray(); var resultEqualEnumParamRight = qry.Where($"it.E == {enumType}.Var2").ToDynamicArray(); // Assert Check.That(resultEqualEnumParamLeft.Single()).Equals(TestEnumPublic.Var2); Check.That(resultEqualEnumParamRight.Single()).Equals(TestEnumPublic.Var2); } [Fact] public void your_sha256_hashould_Throw_Exception() { // Arrange var config = new ParsingConfig { ResolveTypesBySimpleName = true }; var qry = new List<TestEnumClass> { new TestEnumClass { B = TestEnum2.Var2 } }.AsQueryable(); string enumType = typeof(TestEnum2).Name!; // Act Action a = () => qry.Where(config, $"{enumType}.Var2 == it.B").ToDynamicArray(); // Assert a.Should().Throw<Exception>(); } [Fact] public void your_sha256_hashInline_Should_Throw_ParseException() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { E = TestEnumPublic.Var2 } }.AsQueryable(); string enumType = "a.b.c"; // Act Action a = () => qry.Where($"{enumType}.Var2 == it.E").ToDynamicArray(); // Assert a.Should().Throw<ParseException>().WithMessage("Type 'b.c' not found"); } [Fact] public void your_sha256_hashalue_Inline_Should_Throw_ParseException() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { E = TestEnumPublic.Var2 } }.AsQueryable(); string enumType = typeof(TestEnumPublic).FullName!; // Act Action a = () => qry.Where($"{enumType}.VarInvalid == it.E").ToDynamicArray(); // Assert a.Should().Throw<ParseException>().WithMessage("Enum value 'VarInvalid' is not defined in enum type 'System.Linq.Dynamic.Core.Tests.TestEnumPublic'"); } [Fact] public void your_sha256_hashalue_Inline_Should_Throw_ParseException() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { E = TestEnumPublic.Var2 } }.AsQueryable(); string enumType = typeof(TestEnumPublic).FullName!; // Act Action a = () => qry.Where($"{enumType}. == it.E").ToDynamicArray(); // Assert a.Should().Throw<ParseException>().WithMessage("Type 'System.Linq.Dynamic.Core.Tests.' not found"); } [Fact] public void ExpressionTests_Enum_NullableProperty() { // Arrange var qry = new List<TestEnumClass> { new TestEnumClass { C = TestEnum2.Var2 } }.AsQueryable(); // Act var resultEqualEnumParamLeft = qry.Where("@0 == it.C", TestEnum2.Var2).ToDynamicArray(); var resultEqualEnumParamRight = qry.Where("it.C == @0", TestEnum2.Var2).ToDynamicArray(); var resultEqualIntParamLeft = qry.Where("@0 == it.C", 1).ToDynamicArray(); var resultEqualIntParamRight = qry.Where("it.C == @0", 1).ToDynamicArray(); // Assert Check.That(resultEqualEnumParamLeft.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualEnumParamRight.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualIntParamLeft.Single()).Equals(TestEnum2.Var2); Check.That(resultEqualIntParamRight.Single()).Equals(TestEnum2.Var2); } [Fact] public void ExpressionTests_Enum_MoreTests() { var config = new ParsingConfig(); // Arrange var lst = new List<TestEnum> { TestEnum.Var1, TestEnum.Var2, TestEnum.Var3, TestEnum.Var4, TestEnum.Var5, TestEnum.Var6 }; var qry = lst.AsQueryable(); // Act var r1 = qry.Any(config, "it < TestEnum.Var4"); var r2 = qry.First(config, "TestEnum.Var4 > it"); var r3 = qry.FirstOrDefault(config, "it = Var5"); var r4 = qry.Last(config, "@0 = it", TestEnum.Var5); var r5 = qry.LastOrDefault("@0 = it", 8); var r6 = qry.Single(config, "it = @0", "Var5"); var r7 = qry.SingleOrDefault(config, "@0 = it", "vAR5"); var r8 = qry.SkipWhile(config, "it < TestEnum.Var4").FirstOrDefault(); var r9 = qry.TakeWhile(config, "it < TestEnum.Var4").FirstOrDefault(); var r10 = qry.GroupBy(config, "it").FirstOrDefault(); } [Fact] public void ExpressionTests_Enum_Nullable() { // Act var result1a = new[] { TestEnum.Var1 }.AsQueryable().Where("it = @0", (TestEnum?)TestEnum.Var1); var result1b = new[] { TestEnum.Var1 }.AsQueryable().Where("@0 = it", (TestEnum?)TestEnum.Var1); var result2a = new[] { (TestEnum?)TestEnum.Var1, null }.AsQueryable().Where("it = @0", TestEnum.Var1); var result2b = new[] { (TestEnum?)TestEnum.Var1, null }.AsQueryable().Where("@0 = it", TestEnum.Var1); var result3a = new[] { (TestEnum?)TestEnum.Var1, null }.AsQueryable().Where("it = @0", (TestEnum?)TestEnum.Var1); var result3b = new[] { (TestEnum?)TestEnum.Var1, null }.AsQueryable().Where("@0 = it", (TestEnum?)TestEnum.Var1); var result10a = new[] { TestEnum.Var1 }.AsQueryable().Where("it = @0", "Var1"); var result10b = new[] { TestEnum.Var1 }.AsQueryable().Where("@0 = it", "Var1"); var result11a = new[] { (TestEnum?)TestEnum.Var1, null }.AsQueryable().Where("it = @0", "Var1"); var result11b = new[] { (TestEnum?)TestEnum.Var1, null }.AsQueryable().Where("@0 = it", "Var1"); // Assert Assert.Equal(TestEnum.Var1, result1a.Single()); Assert.Equal(TestEnum.Var1, result1b.Single()); Assert.Equal(TestEnum.Var1, result2a.Single()); Assert.Equal(TestEnum.Var1, result2b.Single()); Assert.Equal((TestEnum?)TestEnum.Var1, result3a.Single()); Assert.Equal((TestEnum?)TestEnum.Var1, result3b.Single()); Assert.Equal(TestEnum.Var1, result10a.Single()); Assert.Equal(TestEnum.Var1, result10b.Single()); Assert.Equal((TestEnum?)TestEnum.Var1, result11a.Single()); Assert.Equal((TestEnum?)TestEnum.Var1, result11b.Single()); } [Fact] public void ExpressionTests_FirstOrDefault() { // Arrange var testList = User.GenerateSampleModels(2); testList[0].Roles.Clear(); var testListQry = testList.AsQueryable(); // Act : find first user that has the role of admin var realSingleResult = testListQry.FirstOrDefault(x => x.Roles.FirstOrDefault(y => y.Name == "Admin") != null); var testSingleResult = testListQry.Where("Roles.FirstOrDefault(Name = \"Admin\") != null").FirstOrDefault(); testList[1].Roles.Clear(); //remove roles so the next set fails var realSingleFailResult = testListQry.FirstOrDefault(x => x.Roles.FirstOrDefault(y => y.Name == "Admin") != null); var testSingleFailResult = testListQry.Where("Roles.FirstOrDefault(Name = \"Admin\") != null").FirstOrDefault(); // Assert Assert.Equal(realSingleResult, testSingleResult); Assert.Equal(realSingleFailResult, (User)testSingleFailResult); } [Fact] public void ExpressionTests_FloatQualifiers() { // Arrange var values = new[] { 1f, 2F, 3F }.AsQueryable(); var resultValues = new[] { 2f, 3f }.AsQueryable(); // Act var result1 = values.Where("it == 2F or it == 3f"); var result2 = values.Where("it == 2.0F or it == 3.00f"); // Assert Assert.Equal(resultValues.ToArray(), result1.ToArray()); Assert.Equal(resultValues.ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_FloatQualifiers_Negative() { // Arrange var values = new[] { -1f, -2F, -3F }.AsQueryable(); var resultValues = new[] { -2f, -3f }.AsQueryable(); // Act var result1 = values.Where("it == -2F or it == -3f"); var result2 = values.Where("it == -2.0F or it == -3.0f"); // Assert Assert.Equal(resultValues.ToArray(), result1.ToArray()); Assert.Equal(resultValues.ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_Guid_CompareTo_String() { var config = new ParsingConfig(); #if NETSTANDARD // config.CustomTypeProvider = new NetStandardCustomTypeProvider(); #endif // Arrange var lst = new List<Guid> { new Guid("{0A191E77-E32D-4DE1-8F1C-A144C2B0424D}"), Guid.NewGuid(), Guid.NewGuid() }; var qry = lst.AsQueryable(); // Act string testValue = lst[0].ToString(); var result1a = qry.Where(config, "it = \"0A191E77-E32D-4DE1-8F1C-A144C2B0424D\""); var result1b = qry.Where(config, "it = @0", testValue); var result2a = qry.Where(config, "\"0A191E77-E32D-4DE1-8F1C-A144C2B0424D\" = it"); var result2b = qry.Where(config, "@0 = it", testValue); // Assert Assert.Equal(lst[0], result1a.Single()); Assert.Equal(lst[0], result1b.Single()); Assert.Equal(lst[0], result2a.Single()); Assert.Equal(lst[0], result2b.Single()); } [Fact] public void ExpressionTests_Guid_CompareTo_Guid() { // Arrange var lst = new List<Guid> { new Guid("{0A191E77-E32D-4DE1-8F1C-A144C2B0424D}"), Guid.NewGuid(), Guid.NewGuid() }; var qry = lst.AsQueryable(); // Act Guid testValue = lst[0]; var resulta = qry.Where("it = @0", testValue); var resultb = qry.Where("@0 = it", testValue); // Assert Assert.Equal(testValue, resulta.Single()); Assert.Equal(testValue, resultb.Single()); } [Fact] public void ExpressionTests_GuidNullable_CompareTo_Guid() { // Arrange var lst = new List<Guid?> { new Guid("{0A191E77-E32D-4DE1-8F1C-A144C2B0424D}"), Guid.NewGuid(), Guid.NewGuid() }; var qry = lst.AsQueryable(); // Act Guid testValue = new Guid("{0A191E77-E32D-4DE1-8F1C-A144C2B0424D}"); var resulta = qry.Where("it = @0", testValue); var resultb = qry.Where("@0 = it", testValue); // Assert Assert.Equal(testValue, resulta.Single()); Assert.Equal(testValue, resultb.Single()); } [Fact] public void ExpressionTests_GuidNullable_CompareTo_GuidNullable() { // Arrange var lst = new List<Guid?> { new Guid("{0A191E77-E32D-4DE1-8F1C-A144C2B0424D}"), Guid.NewGuid(), Guid.NewGuid() }; var qry = lst.AsQueryable(); // Act Guid? testValue = lst[0]; var resulta = qry.Where("it = @0", testValue); var resultb = qry.Where("@0 = it", testValue); // Assert Assert.Equal(testValue, resulta.Single()); Assert.Equal(testValue, resultb.Single()); } [Fact] public void ExpressionTests_Guid_CompareTo_Null() { // Arrange var lst = new List<TestGuidNullClass> { new TestGuidNullClass { GuidNull = null, Id = 1 }, new TestGuidNullClass { GuidNull = new Guid("{0A191E77-E32D-4DE1-8F1C-A144C2B0424D}"), Id = 2 } }; var qry = lst.AsQueryable(); // Act var result2a = qry.FirstOrDefault("it.GuidNull = null"); var result2b = qry.FirstOrDefault("null = it.GuidNull"); var result1a = qry.FirstOrDefault("it.GuidNull = @0", new object[] { null }); var result1b = qry.FirstOrDefault("@0 = it.GuidNull", new object[] { null }); // Assert Assert.Equal(1, result1a.Id); Assert.Equal(1, result1b.Id); Assert.Equal(1, result2a.Id); Assert.Equal(1, result2b.Id); } [Fact] public void ExpressionTests_HexadecimalInteger() { // Arrange var values = new[] { 1, 2, 3 }; // Act var result = values.AsQueryable().Select("it * 0x1000abEF").Cast<int>(); var resultNeg = values.AsQueryable().Select("it * -0xaBcDeF").Cast<int>(); var resultU = values.AsQueryable().Select("uint(it) * 0x12345678U").Cast<uint>(); var resultL = values.AsQueryable().Select("it * 0x1234567890abcdefL").Cast<long>(); var resultLNeg = values.AsQueryable().Select("it * -0x0ABCDEF987654321L").Cast<long>(); var resultUL = values.AsQueryable().Select("ulong(it) * 0x1000abEFUL").Cast<ulong>(); // Assert Assert.Equal(values.Select(it => it * 0x1000abEF), result); Assert.Equal(values.Select(it => it * -0xaBcDeF), resultNeg); Assert.Equal(values.Select(it => (uint)it * 0x12345678U), resultU); Assert.Equal(values.Select(it => it * 0x1234567890abcdefL), resultL); Assert.Equal(values.Select(it => it * -0x0ABCDEF987654321L), resultLNeg); Assert.Equal(values.Select(it => (ulong)it * 0x1000abEFUL), resultUL); Assert.Throws<ParseException>(() => values.AsQueryable().Where("it < 0x 11a")); Assert.Throws<ParseException>(() => values.AsQueryable().Where("it < 11a")); } [Fact] public void ExpressionTests_In_Enum() { var config = new ParsingConfig(); #if NETSTANDARD // config.CustomTypeProvider = new NetStandardCustomTypeProvider(); #endif // Arrange var model1 = new ModelWithEnum { TestEnum = TestEnum.Var1 }; var model2 = new ModelWithEnum { TestEnum = TestEnum.Var2 }; var model3 = new ModelWithEnum { TestEnum = TestEnum.Var3 }; var qry = new[] { model1, model2, model3 }.AsQueryable(); // Act var expected = qry.Where(x => new[] { TestEnum.Var1, TestEnum.Var2 }.Contains(x.TestEnum)).ToArray(); var result1 = qry.Where("it.TestEnum in (\"Var1\", \"Var2\")", config).ToArray(); var result2 = qry.Where("it.TestEnum in (0, 1)", config).ToArray(); // Assert Check.That(result1).ContainsExactly(expected); Check.That(result2).ContainsExactly(expected); } [Fact] public void ExpressionTests_In_Short() { // Arrange var qry = new short[] { 1, 2, 3, 4, 5, 6, 7 }.AsQueryable(); // Act var result = qry.Where("it in (1, 2)"); var resultExpected = qry.Where(x => x == 1 || x == 2); // Assert Check.That(resultExpected.ToArray()).ContainsExactly(result.ToDynamicArray<short>()); } [Fact] public void ExpressionTests_In_String() { // Arrange var testRange = Enumerable.Range(1, 100).ToArray(); var testModels = User.GenerateSampleModels(10); var testModelByUsername = string.Format("Username in (\"{0}\",\"{1}\",\"{2}\")", testModels[0].UserName, testModels[1].UserName, testModels[2].UserName); var testInExpression = new[] { 2, 4, 6, 8 }; // Act var result1a = testRange.AsQueryable().Where("it in (2,4,6,8)").ToArray(); var result1b = testRange.AsQueryable().Where("it in (2, 4, 6, 8)").ToArray(); // path_to_url var result2 = testModels.AsQueryable().Where(testModelByUsername).ToArray(); var result3 = testModels.AsQueryable() .Where("Id in (@0, @1, @2)", testModels[0].Id, testModels[1].Id, testModels[2].Id) .ToArray(); var result4 = testRange.AsQueryable().Where("it in @0", testInExpression).ToArray(); // Assert Assert.Equal(new[] { 2, 4, 6, 8 }, result1a); Assert.Equal(new[] { 2, 4, 6, 8 }, result1b); Assert.Equal(testModels.Take(3).ToArray(), result2); Assert.Equal(testModels.Take(3).ToArray(), result3); Assert.Equal(new[] { 2, 4, 6, 8 }, result4); } [Fact] public void ExpressionTests_IsNull_Simple() { // Arrange var baseQuery = new int?[] { 1, 2, null, 3, 4 }.AsQueryable(); var expectedResult = new[] { 1, 2, 0, 3, 4 }; // Act var result1 = baseQuery.Select("isnull(it, 0)"); // Assert Assert.Equal(expectedResult, result1.ToDynamicArray<int>()); } [Fact] public void ExpressionTests_IsNull_Complex() { // Arrange var testModels = User.GenerateSampleModels(3, true); testModels[0].NullableInt = null; testModels[1].NullableInt = null; testModels[2].NullableInt = 5; var expectedResult1 = testModels.AsQueryable().Select(u => new { UserName = u.UserName, X = u.NullableInt ?? (3 * u.Income) }).Cast<object>().ToArray(); var expectedResult2 = testModels.AsQueryable().Where(u => (u.NullableInt ?? 10) == 10).ToArray(); var expectedResult3 = testModels.Select(m => m.NullableInt ?? 10).ToArray(); // Act var result1 = testModels.AsQueryable().Select("new (UserName, isnull(NullableInt, (3 * Income)) as X)"); var result2 = testModels.AsQueryable().Where("isnull(NullableInt, 10) == 10"); var result3a = testModels.AsQueryable().Select("isnull(NullableInt, @0)", 10); var result3b = testModels.AsQueryable().Select<int>("isnull(NullableInt, @0)", 10); // Assert Assert.Equal(expectedResult1.ToString(), result1.ToDynamicArray().ToString()); Assert.Equal(expectedResult2, result2.ToArray()); Assert.Equal(expectedResult3, result3a.ToDynamicArray<int>()); Assert.Equal(expectedResult3, result3b.ToDynamicArray<int>()); } [Fact] public void ExpressionTests_IsNull_ThrowsException() { // Arrange var baseQuery = new int?[] { 1, 2, null, 3, 4 }.AsQueryable(); // Act + Assert Check.ThatCode(() => baseQuery.Select("isnull(it, 0, 4)")).Throws<ParseException>(); } [Fact] public void ExpressionTests_Indexer_Issue57() { var rows = new List<JObject> { new JObject {["Column1"] = "B", ["Column2"] = 1}, new JObject {["Column1"] = "B", ["Column2"] = 2}, new JObject {["Column1"] = "A", ["Column2"] = 1}, new JObject {["Column1"] = "A", ["Column2"] = 2} }; var expected = rows.OrderBy(x => x["Column1"]).ToList(); var result = rows.AsQueryable().OrderBy(@"it[""Column1""]").ToList(); Assert.Equal(expected, result); } // [Fact] // public void ExpressionTests_IComparable_GreaterThan() // { // // Assign // const string id = "111111111111111111111111"; // var queryable = new[] { new TestObjectIdClass { Id = 1, ObjectId = id }, new TestObjectIdClass { Id = 2, ObjectId = "221111111111111111111111" } }.AsQueryable(); // // Act // var result = queryable.Where(x => x.ObjectId > id).ToArray(); // var dynamicResult = queryable.Where("it.ObjectId > @0", id).ToArray(); // // Assert // Check.That(dynamicResult).ContainsExactly(result); // } // [Fact] // public void ExpressionTests_IEquatable_Equal() // { // // Assign // const string id = "111111111111111111111111"; // var queryable = new[] { new TestObjectIdClass { Id = 1, ObjectId = id }, new TestObjectIdClass { Id = 2, ObjectId = ObjectId.Parse("221111111111111111111111") } }.AsQueryable(); // // Act // var result = queryable.First(x => x.ObjectId == ObjectId.Parse(id)); // var dynamicResult = queryable.First("it.ObjectId == @0", ObjectId.Parse(id)); // // Assert // Check.That(dynamicResult.Id).Equals(result.Id); // } // [Fact] // public void ExpressionTests_IEquatable_NotEqual() // { // // Assign // const string id = "111111111111111111111111"; // var queryable = new[] { new TestObjectIdClass { Id = 1, ObjectId = ObjectId.Parse(id) }, new TestObjectIdClass { Id = 2, ObjectId = ObjectId.Parse("221111111111111111111111") } }.AsQueryable(); // // Act // var result = queryable.First(x => x.ObjectId != ObjectId.Parse(id)); // var dynamicResult = queryable.First("it.ObjectId != @0", ObjectId.Parse(id)); // // Assert // Check.That(dynamicResult.Id).Equals(result.Id); // } [Fact] public void ExpressionTests_LogicalAndOr() { // Arrange var lst = new List<int> { 0x20, 0x21, 0x30, 0x31, 0x41 }; var qry = lst.AsQueryable(); // Act var result1 = qry.Where("(it & 1) > 0"); var result2 = qry.Where("(it & 32) > 0"); // Assert Assert.Equal(new[] { 0x21, 0x31, 0x41 }, result1.ToArray()); Assert.Equal(qry.Where(x => (x & 32) > 0).ToArray(), result2.ToArray()); } [Fact] public void ExpressionTests_NewAnonymousType_Paren() { // Arrange var users = User.GenerateSampleModels(1); // Act var expectedResult = users.Select(x => new { x.Id, I = x.Income }).FirstOrDefault(); var result = users.AsQueryable().Select("new (Id, Income as I)").FirstOrDefault(); // Assert Check.That(result).Equals(expectedResult); } [Fact] public void ExpressionTests_NewAnonymousType_CurlyParen() { // Arrange var users = User.GenerateSampleModels(1); // Act var expectedResult = users.Select(x => new { x.Id, I = x.Income }).FirstOrDefault(); var result = users.AsQueryable().Select("new { Id, Income as I }").FirstOrDefault(); // Assert Check.That(result).Equals(expectedResult); } [Fact] public void ExpressionTests_Modulo_Number() { // Arrange var values = new[] { -10, 20 }.AsQueryable(); // Act var result = values.Select<int>("it % 3"); var expected = values.Select(i => i % 3); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void ExpressionTests_Multiply_Number() { // Arrange var values = new[] { -1, 2 }.AsQueryable(); // Act var result = values.Select<int>("it * 10"); var expected = values.Select(i => i * 10); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void ExpressionTests_NullCoalescing() { // Arrange var testModels = User.GenerateSampleModels(3, true); testModels[0].NullableInt = null; testModels[1].NullableInt = null; testModels[2].NullableInt = 5; var expectedResult1 = testModels.AsQueryable().Select(u => new { UserName = u.UserName, X = u.NullableInt ?? (3 * u.Income) }).Cast<object>().ToArray(); var expectedResult2 = testModels.AsQueryable().Where(u => (u.NullableInt ?? 10) == 10).ToArray(); var expectedResult3 = testModels.Select(m => m.NullableInt ?? 10).ToArray(); // Act var result1 = testModels.AsQueryable().Select("new (UserName, NullableInt ?? (3 * Income) as X)"); var result2 = testModels.AsQueryable().Where("(NullableInt ?? 10) == 10"); var result3a = testModels.AsQueryable().Select("NullableInt ?? @0", 10); var result3b = testModels.AsQueryable().Select<int>("NullableInt ?? @0", 10); // Assert Assert.Equal(expectedResult1.ToString(), result1.ToDynamicArray().ToString()); Assert.Equal(expectedResult2, result2.ToDynamicArray<User>()); Assert.Equal(expectedResult3, result3a.ToDynamicArray<int>()); Assert.Equal(expectedResult3, result3b.ToDynamicArray<int>()); } [Theory] [InlineData("np(str)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.str != null)), Param_0.str, null))")] [InlineData("np(str, \"x\")", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.str != null)), Param_0.str, \"x\"))")] [InlineData("np(strNull)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.strNull != null)), Param_0.strNull, null))")] [InlineData("np(strNull, \"x\")", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.strNull != null)), Param_0.strNull, \"x\"))")] [InlineData("np(gnullable)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.gnullable != null)), Param_0.gnullable, null))")] [InlineData("np(dtnullable)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.dtnullable != null)), Param_0.dtnullable, null))")] [InlineData("np(number, 42)", "Select(Param_0 => IIF((Param_0 != null), Param_0.number, 42))")] [InlineData("np(nullablenumber)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nullablenumber != null)), Param_0.nullablenumber, null))")] [InlineData("np(_enumnullable)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0._enumnullable != null)), Param_0._enumnullable, null))")] #if NET48 [InlineData("np(dt)", "Select(Param_0 => IIF((Param_0 != null), Convert(Param_0.dt), null))")] [InlineData("np(_enum)", "Select(Param_0 => IIF((Param_0 != null), Convert(Param_0._enum), null))")] [InlineData("np(g)", "Select(Param_0 => IIF((Param_0 != null), Convert(Param_0.g), null))")] [InlineData("np(number)", "Select(Param_0 => IIF((Param_0 != null), Convert(Param_0.number), null))")] [InlineData("np(nested.g)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Convert(Param_0.nested.g), null))")] [InlineData("np(nested.dt)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Convert(Param_0.nested.dt), null))")] [InlineData("np(nested.number)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Convert(Param_0.nested.number), null))")] [InlineData("np(nested._enum)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Convert(Param_0.nested._enum), null))")] [InlineData("np(item.Id)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.item != null)), Convert(Param_0.item.Id), null))")] [InlineData("np(item.GuidNormal)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.item != null)), Convert(Param_0.item.GuidNormal), null))")] [InlineData("np(nested.dtnullable.Value.Year)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.dtnullable != null)), Convert(Param_0.nested.dtnullable.Value.Year), null))")] #else [InlineData("np(dt)", "Select(Param_0 => IIF((Param_0 != null), Convert(Param_0.dt, Nullable`1), null))")] [InlineData("np(_enum)", "Select(Param_0 => IIF((Param_0 != null), Convert(Param_0._enum, Nullable`1), null))")] [InlineData("np(g)", "Select(Param_0 => IIF((Param_0 != null), Convert(Param_0.g, Nullable`1), null))")] [InlineData("np(number)", "Select(Param_0 => IIF((Param_0 != null), Convert(Param_0.number, Nullable`1), null))")] [InlineData("np(nested.g)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Convert(Param_0.nested.g, Nullable`1), null))")] [InlineData("np(nested.dt)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Convert(Param_0.nested.dt, Nullable`1), null))")] [InlineData("np(nested.number)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Convert(Param_0.nested.number, Nullable`1), null))")] [InlineData("np(nested.number, 42)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Param_0.nested.number, 42))")] [InlineData("np(nested._enum)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Convert(Param_0.nested._enum, Nullable`1), null))")] [InlineData("np(item.Id)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.item != null)), Convert(Param_0.item.Id, Nullable`1), null))")] [InlineData("np(item.GuidNormal)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.item != null)), Convert(Param_0.item.GuidNormal, Nullable`1), null))")] [InlineData("np(nested.dtnullable.Value.Year)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.dtnullable != null)), Convert(Param_0.nested.dtnullable.Value.Year, Nullable`1), null))")] #endif [InlineData("np(nested.strNull)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.strNull != null)), Param_0.nested.strNull, null))")] [InlineData("np(nested.strNull, \"x\")", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.strNull != null)), Param_0.nested.strNull, \"x\"))")] [InlineData("np(nested.gnullable)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.gnullable != null)), Param_0.nested.gnullable, null))")] [InlineData("np(nested.dtnullable)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.dtnullable != null)), Param_0.nested.dtnullable, null))")] [InlineData("np(nested.nullablenumber)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.nullablenumber != null)), Param_0.nested.nullablenumber, null))")] [InlineData("np(nested.nullablenumber, 42)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.nullablenumber != null)), Param_0.nested.nullablenumber, 42))")] [InlineData("np(nested._enumnullable)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested._enumnullable != null)), Param_0.nested._enumnullable, null))")] [InlineData("np(item.GuidNull)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.item != null)) AndAlso (Param_0.item.GuidNull != null)), Param_0.item.GuidNull, null))")] [InlineData("np(items.FirstOrDefault())", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.items != null)), Param_0.items.FirstOrDefault(), null))")] [InlineData("np(items.FirstOrDefault(it != \"x\"))", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.items != null)), Param_0.items.FirstOrDefault(Param_1 => (Param_1 != \"x\")), null))")] public void ExpressionTests_NullPropagating(string test, string query) { // Arrange var q = new[] { new { g = Guid.NewGuid(), gnullable = (Guid?) Guid.NewGuid(), dt = DateTime.Now, dtnullable = (DateTime?) DateTime.Now, _enum = TestEnum2.Var1, _enumnullable = (TestEnum2?) TestEnum2.Var2, number = 1, nullablenumber = (int?) 2, str = "str", strNull = (string) null, nested = new { g = Guid.NewGuid(), gnullable = (Guid?) Guid.NewGuid(), dt = DateTime.Now, dtnullable = (DateTime?) DateTime.Now, _enum = TestEnum2.Var1, _enumnullable = (TestEnum2?) TestEnum2.Var2, number = 1, nullablenumber = (int?) 2, str = "str", strNull = (string) null }, item = new TestGuidNullClass { Id = 100, GuidNormal = Guid.NewGuid(), GuidNull = Guid.NewGuid() }, items = new [] { "a", "b" } } }.AsQueryable(); // Act var resultDynamic = q.Select(test); // Assert string queryAsString = resultDynamic.ToString(); queryAsString = queryAsString.Substring(queryAsString.IndexOf(".Select") + 1).TrimEnd(']'); Check.That(queryAsString).Equals(query); } [Theory] [InlineData("np(number)", "Select(Param_0 => IIF((Param_0 != null), Param_0.number, default(Int32)))")] [InlineData("np(number, 42)", "Select(Param_0 => IIF((Param_0 != null), Param_0.number, 42))")] [InlineData("np(nested.dtnullable.Value.Year)", "Select(Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.nested != null)) AndAlso (Param_0.nested.dtnullable != null)), Param_0.nested.dtnullable.Value.Year, default(Int32)))")] [InlineData("np(nested.number)", "Select(Param_0 => IIF(((Param_0 != null) AndAlso (Param_0.nested != null)), Param_0.nested.number, default(Int32)))")] public void ExpressionTests_NullPropagating_Config_Has_UseDefault(string test, string query) { // Arrange var config = new ParsingConfig { NullPropagatingUseDefaultValueForNonNullableValueTypes = true }; var q = new[] { new { g = Guid.NewGuid(), gnullable = (Guid?) Guid.NewGuid(), dt = DateTime.Now, dtnullable = (DateTime?) DateTime.Now, _enum = TestEnum2.Var1, _enumnullable = (TestEnum2?) TestEnum2.Var2, number = 1, nullablenumber = (int?) 2, str = "str", strNull = (string) null, nested = new { g = Guid.NewGuid(), gnullable = (Guid?) Guid.NewGuid(), dt = DateTime.Now, dtnullable = (DateTime?) DateTime.Now, _enum = TestEnum2.Var1, _enumnullable = (TestEnum2?) TestEnum2.Var2, number = 1, nullablenumber = (int?) 2, str = "str", strNull = (string) null }, item = new TestGuidNullClass { Id = 100, GuidNormal = Guid.NewGuid(), GuidNull = Guid.NewGuid() }, items = new [] { "a", "b" } } }.AsQueryable(); // Act var resultDynamic = q.Select(config, test); // Assert string queryAsString = resultDynamic.ToString(); queryAsString = queryAsString.Substring(queryAsString.IndexOf(".Select") + 1).TrimEnd(']'); Check.That(queryAsString).Equals(query); } [Fact] public void ExpressionTests_NullPropagation_Method() { // Arrange var users = new[] { new User { Roles = new List<Role>() } }.AsQueryable(); // Act var resultDynamic = users.Select("np(Roles.FirstOrDefault(false).Name)").ToDynamicArray(); // Assert Assert.True(resultDynamic[0] == null); } [Fact] public void ExpressionTests_NullPropagation_Method_WithDefaultValue() { // Arrange var defaultRoleName = "x"; var users = new[] { new User { Roles = new List<Role>() } }.AsQueryable(); // Act var resultDynamic = users.Select("np(Roles.FirstOrDefault(false).Name, @0)", defaultRoleName).ToDynamicArray(); // Assert Assert.True(resultDynamic[0] == "x"); } [Fact] public void ExpressionTests_NullPropagating_DateTime() { // Arrange var q = new[] { new { id = 1, date1 = (DateTime?) DateTime.Now, date2 = DateTime.Now.AddDays(-1) } }.AsQueryable(); // Act var result = q.OrderBy(x => x.date2).Select(x => x.id).ToArray(); var resultDynamic = q.OrderBy("np(date1)").Select("id").ToDynamicArray<int>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void ExpressionTests_NullPropagation_NullableDateTime() { // Arrange var q = new[] { new { id = 1, date1 = (DateTime?) DateTime.Now, date2 = DateTime.Now.AddDays(-1)} }.AsQueryable(); // Act var result = q.OrderBy(x => x.date1.Value.Year).Select(x => x.id).ToArray(); var resultDynamic = q.OrderBy("np(date1.Value.Year)").Select("id").ToDynamicArray<int>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void your_sha256_hashue() { // Arrange var testModels = User.GenerateSampleModels(2, true).ToList(); testModels.Add(null); // Add null User testModels[0].NullableInt = null; // Set the NullableInt to null for first User // Act var result = testModels.AsQueryable().Select(t => t != null && t.NullableInt != null ? t.NullableInt : null).ToArray(); var resultDynamic = testModels.AsQueryable().Select("np(it.NullableInt)").ToDynamicArray<int?>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void your_sha256_hashue() { // Arrange var testModels = User.GenerateSampleModels(2, true).ToList(); testModels.Add(null); // Add null User testModels[0].Profile = null; // Set the Profile to null for first User // Act var result = testModels.AsQueryable().Select(t => t != null && t.Profile != null && t.Profile.UserProfileDetails != null ? (long?)t.Profile.UserProfileDetails.Id : null).ToArray(); var resultDynamic = testModels.AsQueryable().Select("np(it.Profile.UserProfileDetails.Id)").ToDynamicArray<long?>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void your_sha256_hashue_Config_Has_UseDefault() { // Arrange var config = new ParsingConfig { NullPropagatingUseDefaultValueForNonNullableValueTypes = true }; var testModels = User.GenerateSampleModels(2, true).ToList(); testModels.Add(null); // Add null User testModels[0].Profile = null; // Set the Profile to null for first User // Act var result = testModels.AsQueryable().Select(t => t != null && t.Profile != null && t.Profile.UserProfileDetails != null ? t.Profile.UserProfileDetails.Id : default(long)).ToArray(); var resultDynamic = testModels.AsQueryable().Select(config, "np(it.Profile.UserProfileDetails.Id)").ToDynamicArray<long>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void your_sha256_hash() { // Arrange var testModels = User.GenerateSampleModels(2, true).ToList(); // Act var result = testModels.AsQueryable().Select(t => t.NullableInt != null ? t.NullableInt : 100).ToArray(); var resultDynamic = testModels.AsQueryable().Select("np(NullableInt, 100)").ToDynamicArray<int>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void ExpressionTests_NullPropagating_String_WithDefaultValue() { // Arrange var testModels = User.GenerateSampleModels(2, true).ToList(); // Act var result = testModels.AsQueryable().Select(t => t.UserName != null ? t.UserName : "x").ToArray(); var resultDynamic = testModels.AsQueryable().Select("np(UserName, \"x\")").ToDynamicArray<string>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void ExpressionTests_NullPropagatingNested1_WithDefaultValue() { // Arrange var testModels = User.GenerateSampleModels(2, true).ToList(); testModels.Add(null); // Add null User testModels[0].UserName = null; // Set the UserName to null for first User // Act var result = testModels.AsQueryable().Select(t => t != null && t.UserName != null ? t.UserName : "x").ToArray(); var resultDynamic = testModels.AsQueryable().Select("np(it.UserName, \"x\")").ToDynamicArray<string>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void ExpressionTests_NullPropagatingNested3_WithDefaultValue() { // Arrange var testModels = User.GenerateSampleModels(2, true).ToList(); testModels.Add(null); // Add null User testModels[0].Profile = null; // Set the Profile to null for first User // Act var result = testModels.AsQueryable().Select(t => t != null && t.Profile != null && t.Profile.UserProfileDetails != null ? t.Profile.UserProfileDetails.Id : 100).ToArray(); var resultDynamic = testModels.AsQueryable().Select("np(it.Profile.UserProfileDetails.Id, 100)").ToDynamicArray<long>(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void ExpressionTests_NullPropagation_ThrowsException() { // Arrange var q = User.GenerateSampleModels(1, true).AsQueryable(); // Act Check.ThatCode(() => q.Select("np()")).Throws<ParseException>(); Check.ThatCode(() => q.Select("np(it.Profile.UserProfileDetails.Id, 1, 2)")).Throws<ParseException>(); Check.ThatCode(() => q.Select("np(1)")).Throws<ParseException>(); } [Fact] public void ExpressionTests_OrElse() { // Arrange var users = new[] { new User { Income = 1 }, new User { Income = 2 }, new User { Income = 3 } }.AsQueryable(); // Act var result = users.Where(u => u.Income == 1 || u.Income == 2).ToArray(); var resultDynamic = users.Where("Income == 1 OrElse Income == 2").ToArray(); // Assert Check.That(resultDynamic).ContainsExactly(result); } [Fact] public void ExpressionTests_OrderBy() { // Arrange var qry = User.GenerateSampleModels(100).AsQueryable(); // Act var orderBy = qry.OrderBy("Id asc, Profile.Age desc"); // Assert Check.That(qry.OrderBy(x => x.Id).ThenByDescending(x => x.Profile.Age).ToArray()).ContainsExactly(orderBy.ToArray()); } [Fact] public void ExpressionTests_Select_DynamicObjects() { // Arrange dynamic a1 = new { Name = "a", BlogId = 100 }; dynamic a2 = new { BlogId = 200, Name = "b" }; var list = new List<dynamic> { a1, a2 }; IQueryable qry = list.AsQueryable(); var result1 = qry.Select("new (it as x)"); var result = result1.Select("x.BlogId"); // Assert Assert.Equal(new[] { 100, 200 }, result.ToDynamicArray<int>()); } [Fact] [Trait("Issue", "136")] public void ExpressionTests_Select_ExpandoObjects() { // Arrange dynamic a = new ExpandoObject(); a.Name = "a"; a.BlogId = 100; dynamic b = new ExpandoObject(); b.Name = "b"; b.BlogId = 200; var list = new List<dynamic> { a, b }; IQueryable qry = list.AsQueryable(); // Act var result = qry.Select("it").Select("BlogId"); // Assert Assert.Equal(new[] { 100, 200 }, result.ToDynamicArray<int>()); } [Fact] public void ExpressionTests_Shift() { ExpressionTests_ShiftInternal<sbyte, int>(); ExpressionTests_ShiftInternal<byte, int>(); ExpressionTests_ShiftInternal<short, int>(); ExpressionTests_ShiftInternal<ushort, int>(); ExpressionTests_ShiftInternal<int, int>(); ExpressionTests_ShiftInternal<uint, uint>(); ExpressionTests_ShiftInternal<long, long>(); ExpressionTests_ShiftInternal<ulong, ulong>(); } [Fact] public void ExpressionTests_Shift_Exception() { // Assign var qry = new[] { 10, 20, 30 }.AsQueryable(); // Act and Assert Check.ThatCode(() => qry.Select("it <<< 1")).Throws<ParseException>(); } private static void ExpressionTests_ShiftInternal<TItemType, TResult>() { // Arrange var lst = new[] { 10, 20, 30 }.Select(item => (TItemType)Convert.ChangeType(item, typeof(TItemType))); var qry = lst.AsQueryable(); int? nullableShift = 2; // Act var result1 = qry.Select("it << 1"); var result2 = qry.Select("it >> 1"); var result3 = qry.Where("it << 2 = 80"); var result4 = qry.Where("it << @0 = 80", nullableShift); // Assert Assert.Equal(new[] { 20, 40, 60 }.Select(item => Convert.ChangeType(item, typeof(TResult))).ToArray(), result1.Cast<object>().ToArray()); Assert.Equal(new[] { 5, 10, 15 }.Select(item => Convert.ChangeType(item, typeof(TResult))).ToArray(), result2.Cast<object>().ToArray()); Assert.Equal(Convert.ChangeType(20, typeof(TItemType)), result3.Single()); Assert.Equal(Convert.ChangeType(20, typeof(TItemType)), result4.Single()); } [Fact] public void ExpressionTests_SkipAndTake() { // Arrange var samples = User.GenerateSampleModels(3); samples[0].Roles = null; samples[1].Roles = new List<Role> { new Role(), new Role() }; var sampleQuery = samples.AsQueryable(); // Act var expectedResult = sampleQuery.Select(x => new { SecondRole = x.Roles != null ? x.Roles.Skip(1).Take(1) : null }).ToArray(); var result = sampleQuery.Select("new ( iif(Roles != null, Roles.Skip(1).Take(1), null) as SecondRole )"); // Assert var resultArray = result.ToDynamicArray(); for (int i = 0; i < expectedResult.Count(); i++) { var expectedEntry = expectedResult[i]; var entry = resultArray[i]; if (expectedEntry.SecondRole == null) Assert.Null(entry.SecondRole); else Assert.Equal(expectedEntry.SecondRole.ToString(), entry.SecondRole.ToString()); } } [Fact] public void ExpressionTests_ImplicitCast() { // Arrange Guid code1 = new Guid("651E08E3-85B1-42D1-80AF-68E28E2B7DA6"); Guid code2 = new Guid("6451FEB2-3226-41D0-961C-B72B7B5A0157"); var samples = User.GenerateSampleModels(3); samples[0].State = new UserState() { StatusCode = code1, Description = "alive" }; samples[1].State = new UserState() { StatusCode = code2, Description = "deceased" }; // Act string queryString = "State == @0"; IList<User> result = samples.AsQueryable().Where(queryString, code1).ToList(); string queryString2 = "@0 == State"; IList<User> result2 = samples.AsQueryable().Where(queryString2, code1).ToList(); // Assert Assert.Equal(1, result.Count); Assert.Equal(code1, result[0].State.StatusCode); Assert.Equal("alive", result[0].State.Description); Assert.Equal(1, result2.Count); Assert.Equal(code1, result2[0].State.StatusCode); Assert.Equal("alive", result2[0].State.Description); } [Fact] public void ExpressionTests_StringCompare() { // Arrange var baseQuery = new[] { "1", "2", "3", "4" }.AsQueryable(); // Act var resultGreaterThan = baseQuery.Where("it > @0", "2"); var resultGreaterThanEqual = baseQuery.Where("it >= @0", "2"); var resultLessThan = baseQuery.Where("it < @0", "3"); var resultLessThanEqual = baseQuery.Where("it <= @0", "3"); // Assert Check.That(resultGreaterThan.ToArray()).ContainsExactly("3", "4"); Check.That(resultGreaterThanEqual.ToArray()).ContainsExactly("2", "3", "4"); Check.That(resultLessThan.ToArray()).ContainsExactly("1", "2"); Check.That(resultLessThanEqual.ToArray()).ContainsExactly("1", "2", "3"); } [Fact] public void ExpressionTests_StringConcatenation() { // Arrange var baseQuery = new[] { new { First = "FirstName", Last = "LastName" } }.AsQueryable(); // Act var resultAddWithPlus = baseQuery.Select<string>("it.First + \" \" + it.Last"); var resultAddWithAmp = baseQuery.Select<string>("it.First & \" \" & it.Last"); var resultAddWithPlusAndParams = baseQuery.Select<string>("it.First + @0 + \" \" + @1", "x", "y"); var resultAddWithAmpAndParams = baseQuery.Select<string>("it.First & @0 & \" \" & @1", "x", "y"); // Assert Assert.Equal("FirstName LastName", resultAddWithPlus.First()); Assert.Equal("FirstName LastName", resultAddWithAmp.First()); Assert.Equal("FirstNamex y", resultAddWithPlusAndParams.First()); Assert.Equal("FirstNamex y", resultAddWithAmpAndParams.First()); } [Fact] public void ExpressionTests_StringEscaping() { // Arrange var baseQuery = new[] { new { Value = "ab\"cd" }, new { Value = "a \\ b" } }.AsQueryable(); // Act var result = baseQuery.Where("it.Value == \"ab\\\"cd\"").ToList(); // Assert Assert.Single(result); Assert.Equal("ab\"cd", result[0].Value); } [Fact] public void ExpressionTests_StringIndexOf() { // Arrange var baseQuery = new[] { new { Value = "ab\"cd" }, new { Value = "a \\ b" } }.AsQueryable(); // Act var result = baseQuery.Where("it.Value.IndexOf('\\\\') != -1").ToList(); // Assert Assert.Single(result); Assert.Equal("a \\ b", result[0].Value); } [Fact] public void ExpressionTests_BinaryAnd() { // Arrange var baseQuery = new[] { new { Int = 5 } }.AsQueryable(); // Act var resultAddWithAmp = baseQuery.Select<int>("it.Int & @0", "4"); var resultAddWithAmp2 = baseQuery.Select<int>("it.Int & @0", "2"); var resultAddWithAmp3 = baseQuery.Select<int>("@0 & it.Int", "4"); // Assert Assert.Equal(4, resultAddWithAmp.First()); Assert.Equal(0, resultAddWithAmp2.First()); Assert.Equal(4, resultAddWithAmp3.First()); } [Fact] public void ExpressionTests_Subtract_Number() { // Arrange var values = new[] { -1, 2 }.AsQueryable(); // Act var result = values.Select<int>("it - 10"); var expected = values.Select(i => i - 10); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void ExpressionTests_Sum() { // Arrange int[] initValues = { 1, 2, 3, 4, 5 }; var qry = initValues.AsQueryable().Select(x => new { strValue = "str", intValue = x }).GroupBy(x => x.strValue); // Act var result = qry.Select("Sum(intValue)").AsDynamicEnumerable().ToArray()[0]; // Assert Assert.Equal(15, result); } [Fact] public void ExpressionTests_Sum_LowerCase() { // Arrange int[] initValues = { 1, 2, 3, 4, 5 }; var qry = initValues.AsQueryable().Select(x => new { strValue = "str", intValue = x }).GroupBy(x => x.strValue); // Act var result = qry.Select("sum(intValue)").AsDynamicEnumerable().ToArray()[0]; // Assert Assert.Equal(15, result); } [Fact] public void ExpressionTests_Sum2() { // Arrange var initValues = new[] { new SimpleValuesModel { FloatValue = 1 }, new SimpleValuesModel { FloatValue = 2 }, new SimpleValuesModel { FloatValue = 3 }, }; var qry = initValues.AsQueryable(); // Act var result = qry.Select("FloatValue").Sum(); var result2 = ((IQueryable<float>)qry.Select("FloatValue")).Sum(); // Assert Assert.Equal(6.0f, result); Assert.Equal(6.0f, result2); } [Fact] public void ExpressionTests_Type_Integer() { // Arrange var qry = new[] { 1, 2, 3, 4, 5, 6 }.AsQueryable(); // Act var resultLessThan = qry.Where("it < 4"); var resultLessThanEqual = qry.Where("it <= 4"); var resultGreaterThan = qry.Where("4 > it"); var resultGreaterThanEqual = qry.Where("4 >= it"); var resultEqualItLeft = qry.Where("it = 5"); var resultEqualItRight = qry.Where("5 = it"); var resultEqualIntParamLeft = qry.Where("@0 = it", 5); var resultEqualIntParamRight = qry.Where("it = @0", 5); // Assert Check.That(resultLessThan.ToArray()).ContainsExactly(1, 2, 3); Check.That(resultLessThanEqual.ToArray()).ContainsExactly(1, 2, 3, 4); Check.That(resultGreaterThan.ToArray()).ContainsExactly(1, 2, 3); Check.That(resultGreaterThanEqual.ToArray()).ContainsExactly(1, 2, 3, 4); Check.That(resultEqualItLeft.Single()).Equals(5); Check.That(resultEqualItRight.Single()).Equals(5); Check.That(resultEqualIntParamLeft.Single()).Equals(5); Check.That(resultEqualIntParamRight.Single()).Equals(5); } [Fact] public void ExpressionTests_Type_Integer_Qualifiers() { // Arrange var valuesL = new[] { 1L, 2L, 3L }.AsQueryable(); var resultValuesL = new[] { 2L, 3L }.AsQueryable(); var valuesU = new[] { 1U, 2U, 3U }.AsQueryable(); var resultValuesU = new[] { 2U, 3U }.AsQueryable(); var valuesUL = new[] { 1UL, 2UL, 3UL }.AsQueryable(); var resultValuesUL = new[] { 2UL, 3UL }.AsQueryable(); // Act var resultL = valuesL.Where("it in (2L, 3L)"); var resultU = valuesU.Where("it in (2U, 3U)"); var resultUL = valuesUL.Where("it in (2UL, 3UL)"); // Assert Assert.Equal(resultValuesL.ToArray(), resultL.ToArray()); Assert.Equal(resultValuesU.ToArray(), resultU.ToArray()); Assert.Equal(resultValuesUL.ToArray(), resultUL.ToArray()); } [Fact] public void ExpressionTests_Type_StructWithIntegerEquality() { // Arrange var valuesL = new[] { new SnowflakeId(1L), new SnowflakeId(100), new SnowflakeId(5) }.AsQueryable(); var resultValuesL = new[] { new SnowflakeId(100) }.AsQueryable(); // Act var resultL = valuesL.Where("it == 100"); var resultLs = valuesL.Where("it = 100"); var resultNL = valuesL.Where("it != 1 && it != 5"); var resultArg = valuesL.Where("it == @0", 100); var resultArgs = valuesL.Where("it = @0", 100); var resultIn = valuesL.Where("it in (100)"); // Assert Assert.Equal(resultValuesL.ToArray(), resultL); Assert.Equal(resultValuesL.ToArray(), resultLs); Assert.Equal(resultValuesL.ToArray(), resultNL); Assert.Equal(resultValuesL.ToArray(), resultArg); Assert.Equal(resultValuesL.ToArray(), resultArgs); Assert.Equal(resultValuesL.ToArray(), resultIn); } [Fact] public void your_sha256_hashruct() { // Arrange var valuesL = new[] { new { Id = new SnowflakeId(1L), Var = 1 }, new { Id = new SnowflakeId(2L), Var = 1 }, new { Id = new SnowflakeId(1L), Var = 2 } }.AsQueryable(); var resultValuesL = new[] { new { Id = new SnowflakeId(1L), Var = 1 } }.AsQueryable().ToArray(); // Act var resultL = valuesL.Where("it.Id == it.Var"); var resultLs = valuesL.Where("it.Id = it.Var"); // Assert Assert.Equal(resultValuesL.ToArray(), resultL); Assert.Equal(resultValuesL.ToArray(), resultLs); } [Fact] public void ExpressionTests_Type_Integer_Qualifiers_Negative() { // Arrange var valuesL = new[] { -1L, -2L, -3L }.AsQueryable(); var resultValuesL = new[] { -2L, -3L }.AsQueryable(); // Act var resultL = valuesL.Where("it <= -2L"); var resultIn = valuesL.Where("it in (-2L, -3L)"); // Assert Assert.Equal(resultValuesL.ToArray(), resultL); Assert.Equal(resultValuesL.ToArray(), resultIn); } [Fact] public void ExpressionTests_Type_Integer_Qualifiers_Exceptions() { // Arrange var values = new[] { 1L, 2L, 3L }.AsQueryable(); // Assert Assert.Throws<ParseException>(() => values.Where("it in (2LL)")); Assert.Throws<ParseException>(() => values.Where("it in (2UU)")); Assert.Throws<ParseException>(() => values.Where("it in (2LU)")); Assert.Throws<ParseException>(() => values.Where("it in (2B)")); Assert.Throws<ParseException>(() => values.Where("it < -2LL")); Assert.Throws<ParseException>(() => values.Where("it < -2UL")); Assert.Throws<ParseException>(() => values.Where("it < -2UU")); Assert.Throws<ParseException>(() => values.Where("it < -2LU")); Assert.Throws<ParseException>(() => values.Where("it < -2B")); } [Fact] public void ExpressionTests_Uri() { // Arrange var lst = new List<Uri> { new Uri("path_to_url"), new Uri("path_to_url"), new Uri("path_to_url") }; var qry = lst.AsQueryable(); // Act var result1 = qry.AsQueryable().Where("it = @0", new Uri("path_to_url")); // Assert Assert.Equal(2, result1.Count()); } /// <summary> /// path_to_url /// </summary> [Fact] public void ExpressionTests_Where_DoubleDecimalCompare() { double d = 1000.0; var list = new List<SimpleValuesModel> { new SimpleValuesModel { DecimalValue = 123423.234M }, new SimpleValuesModel { DecimalValue = 123423423423.2342M }, new SimpleValuesModel { DecimalValue = 2342342433423.23423423M }, new SimpleValuesModel { DecimalValue = 123.234M }, new SimpleValuesModel { DecimalValue = 100000000000.232423423434M }, new SimpleValuesModel { DecimalValue = 100.232423423434M } }; var expected = list.Where(x => (double)x.DecimalValue > d).ToList(); var result = list.AsQueryable().Where("double(DecimalValue) > @0", d).ToList(); Assert.Equal(expected, result); } [Fact] public void ExpressionTests_Where_WithCachedLambda() { var list = new List<SimpleValuesModel> { new SimpleValuesModel { IntValue = 1 }, new SimpleValuesModel { IntValue = 3 }, new SimpleValuesModel { IntValue = 2 }, new SimpleValuesModel { IntValue = 3 } }; var lambda = DynamicExpressionParser.ParseLambda(typeof(SimpleValuesModel), typeof(bool), "IntValue == 3"); var res = DynamicQueryableExtensions.Where(list.AsQueryable(), lambda); Assert.Equal(2, res.Count()); var res2 = DynamicQueryableExtensions.Any(list.AsQueryable(), lambda); Assert.True(res2); var res3 = DynamicQueryableExtensions.Count(list.AsQueryable(), lambda); Assert.Equal(2, res3); var res4 = DynamicQueryableExtensions.First(list.AsQueryable(), lambda); Assert.Equal(res4, list[1]); var res5 = DynamicQueryableExtensions.FirstOrDefault(list.AsQueryable(), lambda); Assert.Equal(res5, list[1]); var res6 = DynamicQueryableExtensions.Last(list.AsQueryable(), lambda); Assert.Equal(res6, list[3]); var res7 = DynamicQueryableExtensions.LastOrDefault(list.AsQueryable(), lambda); Assert.Equal(res7, list[3]); var res8 = DynamicQueryableExtensions.Single(list.AsQueryable().Take(2), lambda); Assert.Equal(res8, list[1]); var res9 = DynamicQueryableExtensions.SingleOrDefault(list.AsQueryable().Take(2), lambda); Assert.Equal(res9, list[1]); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/ExpressionTests.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
23,670
```smalltalk using System.Collections.Generic; using FluentAssertions; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Except_Dynamic_ListOfStrings() { // Arrange var list1 = new List<bool> { true }; var list2 = new List<string> { "User3", "User4" }; var list3 = new List<string> { "User3", "User6", "User7" }; // Act var testQuery = list1.AsQueryable().Select("@0.Except(@1).ToList()", list2, list3); // Assert var result = testQuery.ToDynamicArray<List<string>>(); result.First().Should().BeEquivalentTo(list2.Except(list3)); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Except.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
172
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_All() { // Arrange var expected = _context.Blogs.All(b => b.BlogId > 2000); // Act var actual = _context.Blogs.All("BlogId > 2000"); // Assert Assert.Equal(expected, actual); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.All.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
121
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using FluentAssertions; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class QueryableTests { [Fact] public void Max() { // Arrange var incomes = User.GenerateSampleModels(10).Select(u => u.Income).ToArray(); // Act var expected = incomes.Max(); var actual = incomes.AsQueryable().Max(); // Assert Assert.Equal(expected, actual); } [Fact] public void Max_Selector() { // Arrange var users = User.GenerateSampleModels(10); // Act var expected = users.Max(u => u.Income); var result = users.AsQueryable().Max("Income"); // Assert Assert.Equal(expected, result); } [Fact] public void Max_Where_On_Int() { // Arrange var users = User.GenerateSampleModels(10); // Act var typed = users .Where(u => users.Max(m => m.Income) == u.Income) .ToList(); var dynamic = users.AsQueryable() .Where("@0.Max(Income) == Income", users) .ToList(); // Assert dynamic.Should().BeEquivalentTo(typed); } [Fact] public void Max_Where_On_DateTime() { // Arrange var users = User.GenerateSampleModels(10); // Act var typed = users .Where(u => users.Max(m => m.BirthDate) == u.BirthDate) .ToList(); var dynamic = users.AsQueryable() .Where("@0.Max(BirthDate) == BirthDate", users) .ToList(); // Assert dynamic.Should().BeEquivalentTo(typed); } [Fact] public void Max_Where_On_NullableDateTime() { // Arrange var users = User.GenerateSampleModels(10); // Act var typed = users .Where(u => users.Max(m => m.EndDate) == u.EndDate) .ToList(); var dynamic = users.AsQueryable() .Where("@0.Max(EndDate) == EndDate", users) .ToList(); // Assert dynamic.Should().BeEquivalentTo(typed); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Max.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
491
```smalltalk using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_Any() { // Arrange var expectedQueryable1 = _context.Blogs.Where(b => b.BlogId > 0); bool expectedAny1 = expectedQueryable1.Any(); var expectedQueryable2 = _context.Blogs.Where(b => b.BlogId > 9999); bool expectedAny2 = expectedQueryable2.Any(); // Act IQueryable queryable1 = _context.Blogs.Where("BlogId > 0"); bool any1 = queryable1.Any(); IQueryable queryable2 = _context.Blogs.Where("BlogId > 9999"); bool any2 = queryable2.Any(); // Assert Assert.Equal(expectedAny1, any1); Assert.Equal(expectedAny2, any2); } [Fact] public void Entities_Any_Predicate() { // Arrange bool expectedAny1 = _context.Blogs.Any(b => b.BlogId > 0); bool expectedAny2 = _context.Blogs.Any(b => b.BlogId > 9999); // Act bool any1 = _context.Blogs.AsQueryable().Any("it.BlogId > 0"); bool any2 = _context.Blogs.AsQueryable().Any("it.BlogId > 9999"); // ssert Assert.Equal(expectedAny1, any1); Assert.Equal(expectedAny2, any2); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Any.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
326
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Entities; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { // Not supported : path_to_url [Fact(Skip = "not supported")] public void Entities_TakeWhile() { // Arrange const int total = 33; // Act var expected = _context.Blogs.OrderBy(b => b.BlogId).TakeWhile(b => b.BlogId > 5).ToArray(); var result = _context.Blogs.OrderBy("BlogId").TakeWhile("b.BlogId > 5").ToDynamicArray<Blog>(); // Assert Assert.Equal(expected, result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.TakeWhile.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
146
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Entities; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_Page() { // Arrange const int page = 2; const int pageSize = 10; int total = _context.Blogs.Count(); // Act var expected = _context.Blogs.OrderBy(b => b.BlogId).Page(page, pageSize).ToArray(); IOrderedQueryable queryable = _context.Blogs.Select("it").OrderBy("BlogId"); bool any = queryable.Any(); var count = queryable.Count(); var result = queryable.Page(page, pageSize).ToDynamicArray<Blog>(); // Assert Assert.True(any); Assert.Equal(total, count); Assert.Equal(expected, result); } [Fact] public void Entities_PageResult() { // Arrange const int page = 2; const int pageSize = 10; int total = _context.Blogs.Count(); // Act var expectedResult = _context.Blogs.OrderBy(b => b.BlogId).PageResult(page, pageSize).Queryable.ToArray(); IQueryable queryable = _context.Blogs.Select("it").OrderBy("BlogId"); var count = queryable.Count(); var result = queryable.PageResult(page, pageSize); // Assert Assert.Equal(total, count); Assert.Equal(page, result.CurrentPage); Assert.Equal(pageSize, result.PageSize); Assert.Equal(total, result.RowCount); Assert.Equal(3, result.PageCount); Assert.Equal(expectedResult, result.Queryable.ToDynamicArray<Blog>()); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Page.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
349
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Entities; using Xunit; #if EFCORE using Microsoft.EntityFrameworkCore; #else using System.Data.Entity; #endif namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests : IClassFixture<EntitiesTestsDatabaseFixture> { private static readonly Random Rnd = new Random(1); private readonly BlogContext _context; public EntitiesTests(EntitiesTestsDatabaseFixture fixture) { #if EFCORE var builder = new DbContextOptionsBuilder(); if (fixture.UseInMemory) { builder.UseInMemoryDatabase($"System.Linq.Dynamic.Core.{Guid.NewGuid()}"); } else { builder.UseSqlServer(fixture.ConnectionString); } _context = new BlogContext(builder.Options); _context.Database.EnsureCreated(); #else _context = new BlogContext(fixture.ConnectionString); #endif InternalPopulateTestData(); } private void InternalPopulateTestData() { if (_context.Blogs.Any()) { return; } for (int i = 0; i < 25; i++) { var blog = new Blog { X = i.ToString(), Name = "Blog" + (i + 1), BlogId = 1000 + i, Created = DateTime.Now.AddDays(-Rnd.Next(0, 100)) }; _context.Blogs.Add(blog); for (int j = 0; j < 10; j++) { var post = new Post { PostId = 10000 + i * 10 + j, Blog = blog, Title = $"Blog {i + 1} - Post {j + 1}", Content = "My Content", PostDate = DateTime.Today.AddDays(-Rnd.Next(0, 100)).AddSeconds(Rnd.Next(0, 30000)), NumberOfReads = Rnd.Next(0, 5000) }; _context.Posts.Add(post); } } var singleBlog = new Blog { X = "42", Name = "SingleBlog", BlogId = 12345678, Created = DateTime.Now.AddDays(-Rnd.Next(0, 100)) }; _context.Blogs.Add(singleBlog); _context.Blogs.Add(new Blog { BlogId = 2000, X = "0", Name = "blog a", Created = DateTime.Now }); _context.Blogs.Add(new Blog { BlogId = 2001, X = "0", Name = "blog b", Created = DateTime.Now }); _context.Blogs.Add(new Blog { BlogId = 3000, X = "0", Name = "Blog1", Created = DateTime.Now, NullableInt = null }); _context.Blogs.Add(new Blog { BlogId = 3001, X = "0", Name = "Blog2", Created = DateTime.Now, NullableInt = 5 }); _context.SaveChanges(); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
630
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using System.Threading.Tasks; using Xunit; using System.Linq.Dynamic.Core.Tests.Helpers.Entities; using System.Linq.Expressions; namespace System.Linq.Dynamic.Core.Tests; #if EFCORE || (NET46_OR_GREATER || NET5_0_OR_GREATER || NETCOREAPP2_1_OR_GREATER || NETSTANDARD1_3_OR_GREATER || UAP10_0) public partial class EntitiesTests { [Fact] public void Entities_All_FS() { //Arrange int value = 2000; var expected = _context.Blogs.All(b => b.BlogId > value); //Act var actual = _context.Blogs.AllInterpolated($"BlogId > {value}"); //Assert Assert.Equal(expected, actual); } [Fact] public async Task Entities_AllAsync_FS() { //Arrange int value = 2000; var expected = await _context.Blogs.AllAsync(b => b.BlogId > value); //Act var actual = await _context.Blogs.AllInterpolatedAsync($"BlogId > {value}"); //Assert Assert.Equal(expected, actual); } [Fact] public void Entities_Count_Predicate_FS() { // Arrange const string search = "a"; // Act int expected = _context.Blogs.Count(b => b.Name.Contains(search)); int result = _context.Blogs.CountInterpolated($"Name.Contains({search})"); // Assert Assert.Equal(expected, result); } [Fact] public async Task Entities_CountAsync_Predicate_Args_FS() { // Arrange const string search = "a"; Expression<Func<Blog, bool>> predicate = b => b.Name.Contains(search); #if EFCORE var expected = await EntityFrameworkQueryableExtensions.CountAsync(_context.Blogs, predicate); #else var expected = await QueryableExtensions.CountAsync(_context.Blogs, predicate); #endif // Act int result = await (_context.Blogs as IQueryable).CountInterpolatedAsync($"Name.Contains({search})"); // Assert Assert.Equal(expected, result); } [Fact] public void Entities_LongCount_Predicate_FS() { // Arrange const string search = "a"; // Act long expected = _context.Blogs.LongCount(b => b.Name.Contains(search)); long result = _context.Blogs.LongCountInterpolated($"Name.Contains({search})"); // Assert Assert.Equal(expected, result); } [Fact] public async Task Entities_LongCountAsync_Predicate_Args_FS() { // Arrange const string search = "a"; Expression<Func<Blog, bool>> predicate = b => b.Name.Contains(search); #if EFCORE var expected = await EntityFrameworkQueryableExtensions.LongCountAsync(_context.Blogs, predicate); #else var expected = await QueryableExtensions.LongCountAsync(_context.Blogs, predicate); #endif //Act long result = (_context.Blogs as IQueryable).LongCountInterpolated($"Name.Contains({search})"); //Assert Assert.Equal(expected, result); } [Fact(Skip = "not supported")] public void Entities_TakeWhile_FS() { // Act int value = 5; var expected = _context.Blogs.OrderBy(b => b.BlogId).TakeWhile(b => b.BlogId > value).ToArray(); var result = _context.Blogs.OrderByInterpolated($"BlogId").TakeWhileInterpolated($"b.BlogId > {value}").ToDynamicArray<Blog>(); // Assert Assert.Equal(expected, result); } } #endif ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.FormattableString.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
821
```smalltalk using System.Collections; using System.Collections.Generic; using FluentAssertions; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public class DynamicClassFactoryTests { public DynamicClassFactoryTests() { DynamicClassFactory.ClearGeneratedTypes(); } [Fact] public void CreateGenericComparerTypeForInt() { // Assign var comparer = new CustomCaseInsensitiveComparer(); var comparerGenericType = typeof(IComparer<>).MakeGenericType(typeof(int)); var a = 1; var b = 2; // Act var type = DynamicClassFactory.CreateGenericComparerType(comparerGenericType, comparer.GetType()); // Assert var instance = (IComparer<int>)Activator.CreateInstance(type)!; int greaterThan = instance.Compare(a, b); greaterThan.Should().Be(1); int equal = instance.Compare(a, a); equal.Should().Be(0); int lessThan = instance.Compare(b, a); lessThan.Should().Be(-1); } [Fact] public void CreateGenericComparerTypeForString() { // Assign var comparer = new CustomCaseInsensitiveComparer(); var comparerGenericType = typeof(IComparer<>).MakeGenericType(typeof(string)); var a = "a"; var b = "b"; // Act var type = DynamicClassFactory.CreateGenericComparerType(comparerGenericType, comparer.GetType()); // Assert var instance = (IComparer<string>)Activator.CreateInstance(type); int greaterThan = instance.Compare(a, b); greaterThan.Should().Be(1); int equal = instance.Compare(a, a); equal.Should().Be(0); int lessThan = instance.Compare(b, a); lessThan.Should().Be(-1); } [Fact] public void CreateGenericComparerTypeForDateTime() { // Assign var comparer = new CustomCaseInsensitiveComparer(); var comparerGenericType = typeof(IComparer<>).MakeGenericType(typeof(DateTime)); var a = new DateTime(2022, 1, 1); var b = new DateTime(2023, 1, 1); // Act var type = DynamicClassFactory.CreateGenericComparerType(comparerGenericType, comparer.GetType()); // Assert var instance = (IComparer<DateTime>)Activator.CreateInstance(type); int greaterThan = instance.Compare(a, b); greaterThan.Should().Be(1); int equal = instance.Compare(a, a); equal.Should().Be(0); int lessThan = instance.Compare(b, a); lessThan.Should().Be(-1); } [Fact] public void CreateType_With_PropertyWithDot() { // Arrange var properties = new List<DynamicProperty> { new("x.y", typeof(string)) }; // Act var type = DynamicClassFactory.CreateType(properties); // Assert type.GetProperty("x.y").Should().NotBeNull(); var instance = Activator.CreateInstance(type); instance.Should().NotBeNull(); } } public class CustomCaseInsensitiveComparer : IComparer { public int Compare(object x, object y) { return new CaseInsensitiveComparer().Compare(y, x); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/DynamicClassFactoryTests.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
679
```smalltalk using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void ThenBy_Dynamic() { //Arrange var testList = User.GenerateSampleModels(100); var qry = testList.AsQueryable(); //Act var ordered = qry.OrderBy("Id"); var thenByUserName = ordered.ThenBy("UserName"); var thenByComplex1 = ordered.ThenBy("Profile.Age, Income"); //Assert Assert.Equal(testList.OrderBy(x => x.Id).ThenBy(x => x.UserName).ToArray(), thenByUserName.ToArray()); Assert.Equal(testList.OrderBy(x => x.Id).ThenBy(x => x.Profile.Age).ThenBy(x => x.Income).ToArray(), thenByComplex1.ToArray()); } [Fact] public void ThenBy_Dynamic_AsStringExpression() { //Arrange var testList = User.GenerateSampleModels(100); var qry = testList.AsQueryable(); //Act var expected = qry.SelectMany(x => x.Roles.OrderBy(y => y.Name).ThenBy(y => y.Id)).Select(x => x.Name); var orderById = qry.SelectMany("Roles.OrderBy(Name).ThenBy(Id)").Select("Name"); //Assert Assert.Equal(expected.ToArray(), orderById.Cast<string>().ToArray()); } [Fact] public void ThenBy_Dynamic_Exceptions() { //Arrange var testList = User.GenerateSampleModels(100, allowNullableProfiles: true); var qry = testList.AsQueryable(); //Act var ordered = qry.OrderBy("Id"); Assert.Throws<ParseException>(() => ordered.ThenBy("Bad=3")); Assert.Throws<ParseException>(() => ordered.Where("Id=123")); Assert.Throws<ArgumentNullException>(() => DynamicQueryableExtensions.ThenBy(null, "Id")); Assert.Throws<ArgumentNullException>(() => ordered.ThenBy(null)); Assert.Throws<ArgumentException>(() => ordered.ThenBy("")); Assert.Throws<ArgumentException>(() => ordered.ThenBy(" ")); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.ThenBy.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
446
```smalltalk using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Aggregate_Average() { // Arrange var queryable = new[] { new AggregateTest { Double = 50, Float = 1.0f, Int = 42, NullableDouble = 400, NullableFloat = 100f, NullableInt = 60 }, new AggregateTest { Double = 0, Float = 0.0f, Int = 0, NullableDouble = 0, NullableFloat = 0, NullableInt = 0 } }.AsQueryable(); // Act var resultNullableFloat = queryable.Aggregate("Average", "NullableFloat"); var resultFloat = queryable.Aggregate("Average", "Float"); var resultDouble = queryable.Aggregate("Average", "Double"); var resultNullableDouble = queryable.Aggregate("Average", "NullableDouble"); var resultInt = queryable.Aggregate("Average", "Int"); var resultNullableInt = queryable.Aggregate("Average", "NullableInt"); // Assert Assert.Equal(50f, resultNullableFloat); Assert.Equal(200.0, resultNullableDouble); Assert.Equal(25.0, resultDouble); Assert.Equal(0.5f, resultFloat); Assert.Equal(21.0, resultInt); Assert.Equal(30.0, resultNullableInt); } [Fact] public void Aggregate_Min() { // Arrange var queryable = new[] { new AggregateTest { Double = 50, Float = 1.0f, Int = 42, NullableDouble = 400, NullableFloat = 100f, NullableInt = 60 }, new AggregateTest { Double = 51, Float = 2.0f, Int = 90, NullableDouble = 800, NullableFloat = 101f, NullableInt = 61 } }.AsQueryable(); // Act var resultDouble = queryable.Aggregate("Min", "Double"); var resultFloat = queryable.Aggregate("Min", "Float"); var resultInt = queryable.Aggregate("Min", "Int"); var resultNullableDouble = queryable.Aggregate("Min", "NullableDouble"); var resultNullableFloat = queryable.Aggregate("Min", "NullableFloat"); var resultNullableInt = queryable.Aggregate("Min", "NullableInt"); // Assert Assert.Equal(50.0, resultDouble); Assert.Equal(1.0f, resultFloat); Assert.Equal(42, resultInt); Assert.Equal(400.0, resultNullableDouble); Assert.Equal(100f, resultNullableFloat); Assert.Equal(60, resultNullableInt); } public class AggregateTest { public double Double { get; set; } public double? NullableDouble { get; set; } public float Float { get; set; } public float? NullableFloat { get; set; } public int Int { get; set; } public int? NullableInt { get; set; } } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Aggregate.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
675
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using System.Threading.Tasks; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void ToDynamicList() { // Arrange var testList = User.GenerateSampleModels(3); IQueryable testListQry = testList.AsQueryable(); // Act var realResult = testList.OrderBy(x => x.Roles.ToList().First().Name).Select(x => x.Id); var testResult = testListQry.OrderBy("Roles.ToList().First().Name").Select("Id"); // Assert Assert.Equal(realResult.ToArray(), testResult.ToDynamicList().Cast<Guid>()); } [Fact] public async Task ToDynamicListAsync() { // Arrange var testList = User.GenerateSampleModels(3); IQueryable testListQry = testList.AsQueryable(); // Act var realResult = testList.OrderBy(x => x.Roles.ToList().First().Name).Select(x => x.Id); var testResult = testListQry.OrderBy("Roles.ToList().First().Name").Select("Id"); // Assert var dynamicResult = await testResult.ToDynamicListAsync(); Assert.Equal(realResult.ToArray(), dynamicResult.Cast<Guid>()); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.ToList.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
276
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Entities; #if EFCORE using Microsoft.EntityFrameworkCore.DynamicLinq; #else using EntityFramework.DynamicLinq; #endif using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_FirstOrDefault_Dynamic() { // Act var firstExpected = _context.Blogs.OrderBy(x => x.Posts.OrderBy(y => y.PostDate).FirstOrDefault().PostDate).Select(x => x.BlogId); var firstTest = _context.Blogs.OrderBy("Posts.OrderBy(PostDate).FirstOrDefault().PostDate").Select<int>("BlogId"); // Assert Assert.Equal(firstExpected.ToArray(), firstTest.ToArray()); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.FirstOrDefault.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
149
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Reverse() { var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var result = testListQry.Reverse(); //Assert Assert.Equal(testList.Reverse().ToArray(), result.Cast<User>().ToArray()); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Reverse.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
104
```smalltalk using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_Distinct() { // Act var expected = _context.Blogs.Select(b => b.Posts.Distinct()).ToArray<object>(); var result = _context.Blogs.Select("Posts.Distinct()").ToDynamicArray(); // Assert Assert.Equal(expected, result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Distinct.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
91
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Skip() { //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var resultFull = testListQry.Skip(0); var resultMinus1 = testListQry.Skip(1); var resultHalf = testListQry.Skip(50); var resultNone = testListQry.Skip(100); //Assert Assert.Equal(testList.Skip(0).ToArray(), resultFull.Cast<User>().ToArray()); Assert.Equal(testList.Skip(1).ToArray(), resultMinus1.Cast<User>().ToArray()); Assert.Equal(testList.Skip(50).ToArray(), resultHalf.Cast<User>().ToArray()); Assert.Equal(testList.Skip(100).ToArray(), resultNone.Cast<User>().ToArray()); } [Fact] public void SkipTestForEqualType() { // Arrange var testUsers = User.GenerateSampleModels(100).AsQueryable(); // Act IQueryable results = testUsers.Where("Income > 10"); var result = results.FirstOrDefault(); Type resultType = result.GetType(); Assert.Equal("System.Linq.Dynamic.Core.Tests.Helpers.Models.User", resultType.FullName); var skipResult = results.Skip(1).Take(5).FirstOrDefault(); Type skipResultType = skipResult.GetType(); Assert.Equal("System.Linq.Dynamic.Core.Tests.Helpers.Models.User", skipResultType.FullName); } [Fact] public void SkipTestForEqualElementType() { // Arrange var testUsers = User.GenerateSampleModels(100).AsQueryable(); // Act IQueryable results = testUsers.Where("Income > 10"); var skipResult = results.Skip(1).Take(5); // Assert Assert.Equal(results.ElementType, skipResult.ElementType); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Skip.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
421
```smalltalk using System.Collections.Generic; using System.Linq.Dynamic.Core.CustomTypeProviders; using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using FluentAssertions; using Moq; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class ExpressionTests { private static ParsingConfig CreateParsingConfigForMethodCallTests() { var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>(); customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(User), typeof(Methods), typeof(Foo) }); return new ParsingConfig { CustomTypeProvider = customTypeProvider.Object }; } private class DefaultDynamicLinqCustomTypeProviderForStaticTesting : DefaultDynamicLinqCustomTypeProvider { public DefaultDynamicLinqCustomTypeProviderForStaticTesting() : base(ParsingConfig.Default) { } public override HashSet<Type> GetCustomTypes() => new(base.GetCustomTypes()) { typeof(Methods), typeof(MethodsItemExtension) }; } private static ParsingConfig CreateParsingConfigForStaticMethodCallTests() { return new ParsingConfig { CustomTypeProvider = new DefaultDynamicLinqCustomTypeProviderForStaticTesting(), PrioritizePropertyOrFieldOverTheType = true }; } [Fact] public void ExpressionTests_MethodCall_WithArgument_And_1_OutArgument() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var users = User.GenerateSampleModels(5); // Act string s = ""; var expected = users.Select(u => u.TryParseWithArgument(u.UserName, out s)); var result = users.AsQueryable().Select<bool>(config, "TryParseWithArgument(it.UserName, $out _)"); // Assert result.Should().BeEquivalentTo(expected); } [Fact] public void ExpressionTests_MethodCall_WithArgument_And_2_OutArguments() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var users = User.GenerateSampleModels(5); // Act string s = "?"; int i = -1; var expected = users.Select(u => u.TryParseWithArgumentAndTwoOut(u.UserName, out s, out i)); var result = users.AsQueryable().Select<bool>(config, "TryParseWithArgumentAndTwoOut(UserName, out _, out _)"); // Assert result.Should().BeEquivalentTo(expected); } [Fact] public void ExpressionTests_MethodCall_WithoutArgument_And_OutArgument() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var users = User.GenerateSampleModels(5); // Act string s = ""; var expected = users.Select(u => u.TryParseWithoutArgument(out s)); var result = users.AsQueryable().Select<bool>(config, "TryParseWithoutArgument(out _)"); // Assert result.Should().BeEquivalentTo(expected); } [Fact] public void your_sha256_hashent_ThrowsException() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var users = User.GenerateSampleModels(5); // Act Action action = () => users.AsQueryable().Select<bool>(config, "TryParseWithArgument(it.UserName, $out x)"); // Assert action.Should().Throw<ParseException>().WithMessage("When using an out variable, a discard '_' is required."); } [Fact] public void ExpressionTests_MethodCall_NoParams() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var users = User.GenerateSampleModels(3); // Act var expected = users.Where(u => u.TestMethod1()); var result = users.AsQueryable().Where(config, "TestMethod1()"); // Assert Assert.Equal(expected.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_OneParam_With_it() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var users = User.GenerateSampleModels(3); // Act var expected = users.Where(u => u.TestMethod2(u)); var result = users.AsQueryable().Where(config, "TestMethod2(it)"); // Assert Assert.Equal(expected.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_OneParam_With_User() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var users = User.GenerateSampleModels(10); var testUser = users[2]; // Act var expected = users.Where(u => u.TestMethod3(testUser)); var result = users.AsQueryable().Where(config, "TestMethod3(@0)", testUser); // Assert Assert.Equal(expected.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_GenericStatic() { // Arrange var config = CreateParsingConfigForStaticMethodCallTests(); var list = new[] { 0, 1, 2, 3, 4 }.Select(value => new Methods.Item { Value = value }).ToArray(); // Act var expectedResult = list.Where(x => Methods.StaticGenericMethod(x)); var result = list.AsQueryable().Where(config, "Methods.StaticGenericMethod(it)"); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_Generic() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var list = new[] { 0, 1, 2, 3, 4 }.Select(value => new Methods.Item { Value = value }).ToArray(); // Act var methods = new Methods(); var expectedResult = list.Where(x => methods.GenericMethod(x)); var result = list.AsQueryable().Where(config, "@0.GenericMethod(it)", methods); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_GenericExtension() { // Arrange var config = CreateParsingConfigForStaticMethodCallTests(); var list = new[] { 0, 1, 2, 3, 4 }.Select(value => new Methods.Item { Value = value }).ToArray(); // Act var expectedResult = list.Where(x => MethodsItemExtension.Functions.EfCoreCollate(x.Value, "tlh-KX") == 2); var result = list.AsQueryable().Where(config, "MethodsItemExtension.Functions.EfCoreCollate(it.Value,\"tlh-KX\")==2"); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_ValueTypeToValueTypeParameter() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var list = new[] { 0, 1, 2, 3, 4 }; // Act var methods = new Methods(); var expectedResult = list.Where(x => methods.Method1(x)); var result = list.AsQueryable().Where(config, "@0.Method1(it)", methods); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_ValueTypeToObjectParameterWithCast() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var list = new[] { 0, 1, 2, 3, 4 }; // Act var methods = new Methods(); var expectedResult = list.Where(x => methods.Method2(x)); var result = list.AsQueryable().Where(config, "@0.Method2(object(it))", methods); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void your_sha256_hash() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var list = new[] { 0, 1, 2, 3, 4 }; // Act var methods = new Methods(); var expectedResult = list.Where(x => methods.Method2(x)); var result = list.AsQueryable().Where(config, "@0.Method2(it)", methods); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_NullableValueTypeToObjectParameter() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var list = new int?[] { 0, 1, 2, 3, 4, null }; // Act var methods = new Methods(); var expectedResult = list.Where(x => methods.Method2(x)); var result = list.AsQueryable().Where(config, "@0.Method2(it)", methods); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void ExpressionTests_MethodCall_ReferenceTypeToObjectParameter() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var list = new[] { 0, 1, 2, 3, 4 }.Select(value => new Methods.Item { Value = value }).ToArray(); // Act var methods = new Methods(); var expectedResult = list.Where(x => methods.Method3(x)); var result = list.AsQueryable().Where(config, "@0.Method3(it)", methods); // Assert Assert.Equal(expectedResult.Count(), result.Count()); } [Fact] public void ExpressionTests_NullPropagating_InstanceMethod_0_Arguments() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var expression = "np(FooValue.Zero().Length)"; var q = new[] { new Foo { FooValue = new Foo() } }.AsQueryable(); // Act var result = q.Select(config, expression).FirstOrDefault() as int?; // Assert result.Should().BeNull(); } [Fact] public void ExpressionTests_NullPropagating_InstanceMethod_1_Argument() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var expression = "np(FooValue.One(1).Length)"; var q = new[] { new Foo { FooValue = new Foo() } }.AsQueryable(); // Act var result = q.Select(config, expression).FirstOrDefault() as int?; // Assert result.Should().BeNull(); } [Fact] public void ExpressionTests_NullPropagating_InstanceMethod_2_Arguments() { // Arrange var config = CreateParsingConfigForMethodCallTests(); var expression = "np(FooValue.Two(1, 42).Length)"; var q = new[] { new Foo { FooValue = new Foo() } }.AsQueryable(); // Act var result = q.Select(config, expression).FirstOrDefault() as int?; // Assert result.Should().BeNull(); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/ExpressionTests.MethodCall.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
2,340
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore.DynamicLinq; #else using EntityFramework.DynamicLinq; #endif using System.Threading.Tasks; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public async Task Entities_SingleOrDefaultAsync() { // Arrange var expectedQueryable1 = _context.Blogs.Where(b => b.Name == "SingleBlog"); var expected1 = await expectedQueryable1.SingleOrDefaultAsync(); // Act IQueryable queryable1 = _context.Blogs.Where("Name == \"SingleBlog\""); var result1 = await queryable1.SingleOrDefaultAsync(); // Assert Assert.Equal(expected1, result1); } [Fact] public async Task Entities_SingleOrDefaultAsync_Predicate() { // Arrange #if EFCORE var expected1 = await Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.SingleOrDefaultAsync(_context.Blogs, b => b.Name == "SingleBlog"); #else var expected1 = await System.Data.Entity.QueryableExtensions.SingleOrDefaultAsync(_context.Blogs, b => b.Name == "SingleBlog"); #endif // Act var result1 = await _context.Blogs.AsQueryable().SingleOrDefaultAsync("it.Name == \"SingleBlog\""); // Assert Assert.Equal(expected1, result1); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.SingleOrDefaultAsync.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
277
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; using System.Collections; using System.Collections.Generic; namespace System.Linq.Dynamic.Core.Tests { public partial class EntitiesTests { [Fact] public void Entities_DynamicEnumerableExtensions_ToDynamicArray() { //Arrange var list = new List<SimpleValuesModel>(); list.Add(new SimpleValuesModel { IntValue = 1 }); list.Add(new SimpleValuesModel { IntValue = 2 }); //Act var expected = list.ToArray() as object[]; var result = DynamicEnumerableExtensions.ToDynamicArray(list); //Assert Assert.Equal(expected, result); } [Fact] public void Entities_DynamicEnumerableExtensions_ToDynamicArray_Type1() { //Arrange var list = new List<SimpleValuesModel>(); list.Add(new SimpleValuesModel { IntValue = 1 }); list.Add(new SimpleValuesModel { IntValue = 2 }); //Act var expected = list.ToArray(); var result = DynamicEnumerableExtensions.ToDynamicArray<SimpleValuesModel>(list); //Assert Assert.Equal(expected, result); } [Fact] public void Entities_DynamicEnumerableExtensions_ToDynamicArray_Type2() { //Arrange var list = new List<SimpleValuesModel>(); list.Add(new SimpleValuesModel { IntValue = 1 }); list.Add(new SimpleValuesModel { IntValue = 2 }); //Act var expected = list.ToArray(); var result = DynamicEnumerableExtensions.ToDynamicArray(list, typeof(SimpleValuesModel)); //Assert Assert.Equal(expected, result); } [Fact] public void Entities_DynamicEnumerableExtensions_ToDynamicList() { //Arrange var list = new List<SimpleValuesModel>(); list.Add(new SimpleValuesModel { IntValue = 1 }); list.Add(new SimpleValuesModel { IntValue = 2 }); //Act var expected = list.Select(sv => (object)sv); var result = DynamicEnumerableExtensions.ToDynamicList(list); //Assert Assert.Equal(expected, result); } [Fact] public void Entities_DynamicEnumerableExtensions_ToDynamicList_Type1() { //Arrange var list = new List<SimpleValuesModel>(); list.Add(new SimpleValuesModel { IntValue = 1 }); list.Add(new SimpleValuesModel { IntValue = 2 }); //Act var expected = list; var result = DynamicEnumerableExtensions.ToDynamicList<SimpleValuesModel>(list); //Assert Assert.Equal(expected, result); } [Fact] public void Entities_DynamicEnumerableExtensions_ToDynamicList_Type2() { //Arrange var list = new List<SimpleValuesModel>(); list.Add(new SimpleValuesModel { IntValue = 1 }); list.Add(new SimpleValuesModel { IntValue = 2 }); //Act var expected = list; var result = DynamicEnumerableExtensions.ToDynamicList(list, typeof(SimpleValuesModel)); //Assert Assert.Equal(expected, result); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.DynamicEnumerableExtensions.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
661
```smalltalk using System.Collections; using System.Linq.Dynamic.Core.Tests.Helpers.Entities; #if EFCORE using Microsoft.EntityFrameworkCore; #else using System.Data.Entity; #endif using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { /// <summary> /// Test for path_to_url /// </summary> [Fact] public void Entities_Where_Include() { // Arrange var expected = _context.Blogs.Include(b => b.Posts).Where(b => b.BlogId > 2000).ToArray(); // Act var test = _context.Blogs.Include(b => b.Posts).Where("BlogId > 2000").ToArray(); // Assert Assert.Equal(expected, test); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Include.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
159
```smalltalk using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_LongCount_Predicate() { // Arrange const string search = "a"; // Act long expected = _context.Blogs.LongCount(b => b.Name.Contains(search)); long result = _context.Blogs.LongCount("Name.Contains(@0)", search); // Assert Assert.Equal(expected, result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.LongCount.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
98
```smalltalk using NFluent; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { // path_to_url #if EFCORE [Fact] public void Entities_Cast_To_FromStringToInt() { // Act var result = _context.Blogs .Where(b => b.BlogId >= 1000 && b.BlogId <= 1001) .AsQueryable() .Select("X") .Select("Cast(\"int\")") .ToDynamicArray<int>(); // Assert Assert.Equal(new[] { 0, 1 }, result); } #endif // path_to_url [Fact] public void Entities_Cast_To_nullableint() { // Act var expectedResult = _context.Blogs.Select(b => (int?)b.BlogId).Count(); var result = _context.Blogs.AsQueryable().Select("int?(BlogId)").Count(); // Assert Assert.Equal(expectedResult, result); } [Fact] public void Entities_Cast_To_nullableint_Automatic() { // Act var expectedResult = _context.Blogs.Select(b => b.BlogId == 2 ? (int?)b.BlogId : null).ToList(); var result = _context.Blogs.AsQueryable().Select("BlogId == 2 ? BlogId : null").ToDynamicList<int?>(); // Assert Check.That(result).ContainsExactly(expectedResult); } [Fact] public void Entities_Cast_To_nullablelong() { // Act var expectedResult = _context.Blogs.Select(b => (long?)b.BlogId).Count(); var result = _context.Blogs.AsQueryable().Select("long?(BlogId)").Count(); // Assert Assert.Equal(expectedResult, result); } // path_to_url [Fact] public void Entities_Cast_To_newnullableint() { // Act var expectedResult = _context.Blogs.Select(x => new { i = (int?)x.BlogId }).Count(); var result = _context.Blogs.AsQueryable().Select("new (int?(BlogId) as i)").Count(); //Assert Assert.Equal(expectedResult, result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Cast.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
484
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Sum() { // Arrange var incomes = User.GenerateSampleModels(100).Select(u => u.Income); // Act var expected = incomes.Sum(); var actual = incomes.AsQueryable().Sum(); // Assert Assert.Equal(expected, actual); } [Fact] public void Sum_Selector() { // Arrange var users = User.GenerateSampleModels(100); // Act var expected = users.Sum(u => u.Income); var result = users.AsQueryable().Sum("Income"); // Assert Assert.Equal(expected, result); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Sum.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
170
```smalltalk using System.Collections.Generic; using System.Globalization; using System.Linq.Dynamic.Core.Config; using System.Linq.Dynamic.Core.CustomTypeProviders; using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Helpers; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using System.Linq.Dynamic.Core.Tests.TestHelpers; using System.Linq.Expressions; using System.Reflection; using FluentAssertions; using Moq; using NFluent; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public class DynamicExpressionParserTests { [DynamicLinqType] public class Z { } public class Foo { public Foo FooValue { get; set; } public string Zero() => null; public string One(int x) => null; public string Two(int x, int y) => null; } private class MyClass { public List<string> MyStrings { get; set; } public List<MyClass> MyClasses { get; set; } public int Foo() { return 42; } public void Bar() { Name = nameof(Foo); } public string? Name { get; set; } public string? Description { get; set; } public MyClass Child { get; set; } } private class MyClassCustomTypeProvider : DefaultDynamicLinqCustomTypeProvider { public MyClassCustomTypeProvider() : base(ParsingConfig.Default) { } public override HashSet<Type> GetCustomTypes() { var customTypes = base.GetCustomTypes(); customTypes.Add(typeof(MyClass)); return customTypes; } } private class ComplexParseLambda1Result { public int? Age; public int TotalIncome; public string Name; } [DynamicLinqType] public class ComplexParseLambda3Result { public int? Age { get; set; } public int TotalIncome { get; set; } } public class CustomClassWithMethod { public int GetAge(int x) => x; } [DynamicLinqType] public class CustomClassWithMethodWithDynamicLinqTypeAttribute { public int GetAge(int x) => x; } [DynamicLinqType] public interface ICustomInterfaceWithMethodWithDynamicLinqTypeAttribute { int GetAge(int x); } public class CustomClassImplementingInterface : ICustomInterfaceWithMethodWithDynamicLinqTypeAttribute { public int GetAge(int x) => x; } [DynamicLinqType] public class CustomClassWithStaticMethodWithDynamicLinqTypeAttribute { public static int GetAge(int x) => x; } public class CustomTextClass { public CustomTextClass(string origin) { Origin = origin; } public string Origin { get; } public static implicit operator string(CustomTextClass customTextValue) { return customTextValue.Origin; } public static implicit operator CustomTextClass(string origin) { return new CustomTextClass(origin); } public override string ToString() { return Origin; } } public class CustomClassWithOneWayImplicitConversion { public CustomClassWithOneWayImplicitConversion(string origin) { Origin = origin; } public string Origin { get; } public static implicit operator CustomClassWithOneWayImplicitConversion(string origin) { return new CustomClassWithOneWayImplicitConversion(origin); } public override string ToString() { return Origin; } } public class CustomClassWithReversedImplicitConversion { public CustomClassWithReversedImplicitConversion(string origin) { Origin = origin; } public string Origin { get; } public static implicit operator string(CustomClassWithReversedImplicitConversion origin) { return origin.ToString(); } public override string ToString() { return Origin; } } public class CustomClassWithValueTypeImplicitConversion { public CustomClassWithValueTypeImplicitConversion(int origin) { Origin = origin; } public int Origin { get; } public static implicit operator CustomClassWithValueTypeImplicitConversion(int origin) { return new CustomClassWithValueTypeImplicitConversion(origin); } public override string ToString() { return Origin.ToString(); } } public class CustomClassWithReversedValueTypeImplicitConversion { public CustomClassWithReversedValueTypeImplicitConversion(int origin) { Origin = origin; } public int Origin { get; } public static implicit operator int(CustomClassWithReversedValueTypeImplicitConversion origin) { return origin.Origin; } public override string ToString() { return Origin.ToString(); } } public class TestImplicitConversionContainer { public TestImplicitConversionContainer( CustomClassWithOneWayImplicitConversion oneWay, CustomClassWithReversedImplicitConversion reversed, CustomClassWithValueTypeImplicitConversion valueType, CustomClassWithReversedValueTypeImplicitConversion reversedValueType) { OneWay = oneWay; Reversed = reversed; ValueType = valueType; ReversedValueType = reversedValueType; } public CustomClassWithOneWayImplicitConversion OneWay { get; } public CustomClassWithReversedImplicitConversion Reversed { get; } public CustomClassWithValueTypeImplicitConversion ValueType { get; } public CustomClassWithReversedValueTypeImplicitConversion ReversedValueType { get; } } public class TextHolder { public TextHolder(string name, CustomTextClass note) { Name = name; Note = note; } public string Name { get; } public CustomTextClass Note { get; } public override string ToString() { return Name + " (" + Note + ")"; } } internal class TestClass794 { public byte ByteValue { get; set; } public byte? NullableByteValue { get; set; } public int IntValue { get; set; } public int? NullableIntValue { get; set; } } [Theory] [InlineData("Average")] [InlineData("Max")] [InlineData("Min")] [InlineData("Sum")] public void DynamicExpressionParser_ParseLambda_Aggregate(string operation) { foreach (var propertyInfo in typeof(TestClass794).GetProperties()) { var expression = $"{operation}({propertyInfo.Name})"; // e.g., "Sum(ByteValue)" // Act on IEnumerable DynamicExpressionParser.ParseLambda(itType: typeof(IEnumerable<TestClass794>), resultType: typeof(double?), expression: expression); // Act on IQueryable DynamicExpressionParser.ParseLambda(itType: typeof(IQueryable<TestClass794>), resultType: typeof(double?), expression: expression); } } [Fact] public void your_sha256_hashicQuery_false_String() { // Assign var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = false }; // Act var expression = DynamicExpressionParser.ParseLambda<string, bool>(config, true, "s => s == \"x\""); // Assert ConstantExpression constantExpression = (ConstantExpression)((BinaryExpression)expression.Body).Right; object value = constantExpression.Value; Check.That(value).IsEqualTo("x"); } [Fact] public void your_sha256_hashicQuery_false_DateTime() { // Assign var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = false }; // Act var expression = DynamicExpressionParser.ParseLambda<Person, bool>(config, true, "D == \"2022-03-02\""); // Assert ConstantExpression constantExpression = (ConstantExpression)((BinaryExpression)expression.Body).Right; object value = constantExpression.Value; Check.That(value).IsEqualTo(new DateTime(2022, 3, 2)); } [Fact] public void your_sha256_hashicQuery_true_Int() { // Assign var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act var expression = DynamicExpressionParser.ParseLambda<Person, bool>(config, false, "Id = 42"); var expressionAsString = expression.ToString(); // Assert expressionAsString.Should().Be("Param_0 => (Param_0.Id == value(System.Linq.Dynamic.Core.Parser.WrappedValue`1[System.Int32]).Value)"); ConstantExpression constantExpression = (ConstantExpression)((MemberExpression)((BinaryExpression)expression.Body).Right).Expression; var wrappedObj = constantExpression!.Value; PropertyInfo propertyInfo = wrappedObj!.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); object value = propertyInfo!.GetValue(wrappedObj); Check.That(value).IsEqualTo(42); } [Fact(Skip = "Issue 645")] public void your_sha256_hashicQuery_true_DateTime() { // Assign var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act var expression = DynamicExpressionParser.ParseLambda<Person, bool>(config, false, "D = \"2022-11-16\""); var expressionAsString = expression.ToString(); // Assert expressionAsString.Should().Be("Param_0 => (Param_0.D == value(System.Linq.Dynamic.Core.Parser.WrappedValue`1[System.DateTime]).Value)"); ConstantExpression constantExpression = (ConstantExpression)((MemberExpression)((BinaryExpression)expression.Body).Right).Expression; var wrappedObj = constantExpression!.Value; PropertyInfo propertyInfo = wrappedObj!.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); object value = propertyInfo!.GetValue(wrappedObj); Check.That(value).IsEqualTo(new DateTime(2022, 11, 16)); } [Theory] [InlineData("NullableIntValue", "42")] [InlineData("NullableDoubleValue", "42.23")] public void your_sha256_hashicQuery_ForNullableProperty_true(string propName, string valueString) { // Assign var culture = CultureInfo.CreateSpecificCulture("en-US"); var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true, NumberParseCulture = culture }; // Act var expression = DynamicExpressionParser.ParseLambda<SimpleValuesModel, bool>(config, false, $"{propName} = {valueString}"); var expressionAsString = expression.ToString(); // Assert var queriedProp = typeof(SimpleValuesModel).GetProperty(propName, BindingFlags.Instance | BindingFlags.Public)!; var queriedPropType = queriedProp.PropertyType; var queriedPropUnderlyingType = Nullable.GetUnderlyingType(queriedPropType); expressionAsString.Should().StartWith($"Param_0 => (Param_0.{propName}").And.Contain($"System.Linq.Dynamic.Core.Parser.WrappedValue`1[{queriedPropUnderlyingType}])"); dynamic constantExpression = (ConstantExpression)((MemberExpression)((UnaryExpression)((BinaryExpression)expression.Body).Right).Operand).Expression!; object wrapperObj = constantExpression.Value; var propertyInfo = wrapperObj.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public)!; var value = propertyInfo.GetValue(wrapperObj); value.Should().Be(Convert.ChangeType(valueString, Nullable.GetUnderlyingType(queriedPropType) ?? queriedPropType, culture)); } [Theory] [InlineData("Where(x => x.SnowflakeId == {0})")] [InlineData("Where(x => x.SnowflakeId = {0})")] public void DynamicExpressionParser_ParseLambda_WithStructWithEquality(string query) { // Assign var testList = User.GenerateSampleModels(51); var qry = testList.AsQueryable(); // Act var expectedX = (ulong)long.MaxValue + 3; query = string.Format(query, expectedX); var expression = DynamicExpressionParser.ParseLambda(qry.GetType(), null, query); var del = expression.Compile(); var result = del.DynamicInvoke(qry) as IEnumerable<dynamic>; var expected = qry.Where(gg => gg.SnowflakeId == new SnowflakeId(expectedX)).ToList(); // Assert Check.That(result).IsNotNull(); Check.That(result).HasSize(expected.Count); Check.That(result.ToArray()[0]).Equals(expected[0]); } // #626 [Theory] [InlineData("BooleanVariable1 && Bool2", true)] [InlineData("BooleanVariable1 || Bool2", true)] [InlineData("BooleanVariable1 && Bool3", false)] [InlineData("BooleanVariable1 || Bool3", true)] [InlineData("BooleanVariable1 && BooleanVariable4", false)] [InlineData("BooleanVariable1 || BooleanVariable4", true)] public void DynamicExpressionParser_ParseLambda_WithStruct_UsingOperators(string query, bool expectedResult) { // Assign var model = new { BooleanVariable1 = new BooleanVariable(true), Bool2 = true, Bool3 = false, BooleanVariable4 = new BooleanVariable(false) }; // Act var expr = DynamicExpressionParser.ParseLambda(model.GetType(), null, query); var compiled = expr.Compile(); var result = compiled.DynamicInvoke(model); // Assert result.Should().Be(expectedResult); } [Fact] public void DynamicExpressionParser_ParseLambda_ToList() { // Arrange var testList = User.GenerateSampleModels(51); var qry = testList.AsQueryable(); // Act var query = "OrderBy(gg => gg.Income).ToList()"; var expression = DynamicExpressionParser.ParseLambda(qry.GetType(), null, query); var del = expression.Compile(); var result = del.DynamicInvoke(qry) as IEnumerable<dynamic>; var expected = qry.OrderBy(gg => gg.Income).ToList(); // Assert Check.That(result).IsNotNull(); Check.That(result).HasSize(expected.Count); Check.That(result.ToArray()[0]).Equals(expected[0]); } [Fact] public void DynamicExpressionParser_ParseLambda_Complex_1() { // Arrange var testList = User.GenerateSampleModels(51); var qry = testList.AsQueryable(); var externals = new Dictionary<string, object> { {"Users", qry} }; // Act var query = "Users.GroupBy(x => new { x.Profile.Age }).OrderBy(gg => gg.Key.Age).Select(j => new (j.Key.Age, j.Sum(k => k.Income) As TotalIncome))"; var expression = DynamicExpressionParser.ParseLambda(null, query, externals); var del = expression.Compile(); var result = del.DynamicInvoke() as IEnumerable<dynamic>; var expected = qry.GroupBy(x => new { x.Profile.Age }).OrderBy(gg => gg.Key.Age) .Select(j => new { j.Key.Age, TotalIncome = j.Sum(k => k.Income) }) .Select(c => new ComplexParseLambda1Result { Age = c.Age, TotalIncome = c.TotalIncome }).Cast<dynamic>() .ToArray(); // Assert Check.That(result).IsNotNull(); Check.That(result).HasSize(expected.Length); Check.That(result.ToArray()[0]).Equals(expected[0]); } [Fact] public void DynamicExpressionParser_ParseLambda_Complex_2() { // Arrange var testList = User.GenerateSampleModels(51); var qry = testList.AsQueryable(); // Act var query = "GroupBy(x => new { x.Profile.Age }, it).OrderBy(gg => gg.Key.Age).Select(j => new (j.Key.Age, j.Sum(k => k.Income) As TotalIncome))"; var expression = DynamicExpressionParser.ParseLambda(qry.GetType(), null, query); var del = expression.Compile(); var result = del.DynamicInvoke(qry) as IEnumerable<dynamic>; var expected = qry.GroupBy(x => new { x.Profile.Age }, x => x).OrderBy(gg => gg.Key.Age) .Select(j => new { j.Key.Age, TotalIncome = j.Sum(k => k.Income) }) .Select(c => new ComplexParseLambda1Result { Age = c.Age, TotalIncome = c.TotalIncome }).Cast<dynamic>() .ToArray(); // Assert Check.That(result).IsNotNull(); Check.That(result).HasSize(expected.Length); Check.That(result.ToArray()[0]).Equals(expected[0]); } [Fact] public void DynamicExpressionParser_ParseLambda_Complex_3() { var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; // Arrange var testList = User.GenerateSampleModels(51); var qry = testList.AsQueryable(); var externals = new Dictionary<string, object> { {"Users", qry} }; // Act var stringExpression = "Users.GroupBy(x => new { x.Profile.Age }).OrderBy(gg => gg.Key.Age).Select(j => new System.Linq.Dynamic.Core.Tests.DynamicExpressionParserTests+ComplexParseLambda3Result{j.Key.Age, j.Sum(k => k.Income) As TotalIncome})"; var expression = DynamicExpressionParser.ParseLambda(config, null, stringExpression, externals); var del = expression.Compile(); var result = del.DynamicInvoke() as IEnumerable<dynamic>; var expected = qry.GroupBy(x => new { x.Profile.Age }).OrderBy(gg => gg.Key.Age) .Select(j => new ComplexParseLambda3Result { Age = j.Key.Age, TotalIncome = j.Sum(k => k.Income) }) .Cast<dynamic>().ToArray(); // Assert Check.That(result).IsNotNull(); Check.That(result).HasSize(expected.Length); Check.That(result.ToArray()[0]).Equals(expected[0]); } [Fact] public void DynamicExpressionParser_ParseLambda_Select_1() { // Arrange var testList = User.GenerateSampleModels(51); var qry = testList.AsQueryable(); var externals = new Dictionary<string, object> { {"Users", qry} }; // Act var query = "Users.Select(j => new User(j.Income As Income))"; var expression = DynamicExpressionParser.ParseLambda(null, query, externals); var del = expression.Compile(); var result = del.DynamicInvoke(); // Assert Assert.NotNull(result); } [Fact] public void DynamicExpressionParser_ParseLambda_Select_2() { // Arrange var testList = User.GenerateSampleModels(5); var qry = testList.AsQueryable(); var externals = new Dictionary<string, object> { {"Users", qry} }; // Act var query = "Users.Select(j => j)"; var expression = DynamicExpressionParser.ParseLambda(null, query, externals); var del = expression.Compile(); var result = del.DynamicInvoke(); // Assert Assert.NotNull(result); } // #801 [Fact] public void DynamicExpressionParser_ParseLambda_IQueryable() { // Assign var qry = new[] { new { MessageClassName = "mc" } }.AsQueryable(); // Act var expression = DynamicExpressionParser.ParseLambda(qry.GetType(), null, "it.GroupBy(MessageClassName).Select(it.Key).Where(it != null).Distinct().OrderBy(it).Take(1000)"); // Assert expression.ToDebugView().Should().Contain(".Call System.Linq.Queryable"); expression.ToDebugView().Should().NotContain(".Call System.Linq.Enumerable"); } // path_to_url [Fact] public void DynamicExpressionParser_ParseLambda_Issue58() { // Arrange var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>(); customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(MyClass) }); var config = new ParsingConfig { CustomTypeProvider = customTypeProvider.Object }; var expressionParams = new[] { Expression.Parameter(typeof(MyClass), "myObj") }; var myClassInstance = new MyClass(); var invokersMerge = new List<object> { myClassInstance }; // Act var expression = DynamicExpressionParser.ParseLambda(config, false, expressionParams, null, "myObj.Foo()"); var del = expression.Compile(); var result = del.DynamicInvoke(invokersMerge.ToArray()); // Assert Check.That(result).Equals(42); } [Fact] public void your_sha256_hashwsException() { // Arrange var parameters = new[] { Expression.Parameter(typeof(int), "x"), Expression.Parameter(typeof(int), "x") }; // Act and Assert Check.ThatCode(() => DynamicExpressionParser.ParseLambda(parameters, typeof(bool), "it == 42")) .Throws<ParseException>() .WithMessage("The identifier 'x' was defined more than once"); } [Fact] public void DynamicExpressionParser_ParseLambda_EmptyParameterList() { // Arrange var pEmpty = new ParameterExpression[] { }; // Act var @delegate = DynamicExpressionParser.ParseLambda(pEmpty, null, "1+2").Compile(); var result = @delegate.DynamicInvoke() as int?; // Assert Check.That(result).Equals(3); } [Fact] public void DynamicExpressionParser_ParseLambda_ParameterName() { // Arrange var parameters = new[] { Expression.Parameter(typeof(int), "x") }; // Assert var expressionX = DynamicExpressionParser.ParseLambda(parameters, typeof(bool), "x == 42"); var expressionIT = DynamicExpressionParser.ParseLambda(parameters, typeof(bool), "it == 42"); // Assert Assert.Equal(typeof(bool), expressionX.Body.Type); Assert.Equal(typeof(bool), expressionIT.Body.Type); } [Fact] public void DynamicExpressionParser_ParseLambda_ParameterName_Empty() { // Arrange var parameters = new[] { Expression.Parameter(typeof(int), "") }; // Assert var expression = DynamicExpressionParser.ParseLambda(parameters, typeof(bool), "it == 42"); // Assert Assert.Equal(typeof(bool), expression.Body.Type); } [Fact] public void DynamicExpressionParser_ParseLambda_ParameterName_Null() { // Arrange var parameters = new[] { Expression.Parameter(typeof(int), null) }; // Assert var expression = DynamicExpressionParser.ParseLambda(parameters, typeof(bool), "it == 42"); // Assert Assert.Equal(typeof(bool), expression.Body.Type); } [Fact] public void your_sha256_hashl_ReturnsIntExpression() { var expression = DynamicExpressionParser.ParseLambda(true, new[] { Expression.Parameter(typeof(int), "x") }, typeof(int), "x + 1"); Assert.Equal(typeof(int), expression.Body.Type); } public static object[][] Decimals() { return new object[][] { new object[] { "de-DE", "1m", 1f }, new object[] { "de-DE", "-42,0m", -42m }, new object[] { "de-DE", "3,215m", 3.215m }, new object[] { null, "1m", 1f }, new object[] { null, "-42.0m", -42m }, new object[] { null, "3.215m", 3.215m } }; } [Theory] [MemberData(nameof(Decimals))] public void DynamicExpressionParser_ParseLambda_Decimal(string culture, string expression, decimal expected) { // Arrange var config = new ParsingConfig(); if (culture != null) { config.NumberParseCulture = CultureInfo.CreateSpecificCulture(culture); } var parameters = new ParameterExpression[0]; // Act var lambda = DynamicExpressionParser.ParseLambda(config, parameters, typeof(decimal), expression); var result = lambda.Compile().DynamicInvoke(); // Assert result.Should().Be(expected); } public static object[][] Floats() { return new object[][] { new object[] { "de-DE", "1F", 1f }, new object[] { "de-DE", "1f", 1f }, new object[] { "de-DE", "-42f", -42d }, new object[] { "de-DE", "3,215f", 3.215d }, new object[] { null, "1F", 1f }, new object[] { null, "1f", 1f }, new object[] { null, "-42f", -42d }, new object[] { null, "3.215f", 3.215d }, }; } [Theory] [MemberData(nameof(Floats))] public void DynamicExpressionParser_ParseLambda_Float(string culture, string expression, float expected) { // Arrange var config = new ParsingConfig(); if (culture != null) { config.NumberParseCulture = CultureInfo.CreateSpecificCulture(culture); } var parameters = new ParameterExpression[0]; // Act var lambda = DynamicExpressionParser.ParseLambda(config, parameters, typeof(float), expression); var result = lambda.Compile().DynamicInvoke(); // Assert result.Should().Be(expected); } public static IEnumerable<object[]> Doubles() { return new object[][] { new object[] { "de-DE", "1D", 1d }, new object[] { "de-DE", "1d", 1d }, new object[] { "de-DE", "-42d", -42d }, new object[] { "de-DE", "3,215d", 3.215d }, new object[] { "de-DE", "1,2345E-4", 0.00012345d }, new object[] { "de-DE", "1,2345E4", 12345d }, new object[] { null, "1D", 1d }, new object[] { null, "1d", 1d }, new object[] { null, "-42d", -42d }, new object[] { null, "3.215d", 3.215d }, new object[] { null, "1.2345E-4", 0.00012345d }, new object[] { null, "1.2345E4", 12345d } }; } [Theory] [MemberData(nameof(Doubles))] public void DynamicExpressionParser_ParseLambda_Double(string culture, string expression, double expected) { // Arrange var config = new ParsingConfig(); if (culture != null) { config.NumberParseCulture = CultureInfo.CreateSpecificCulture(culture); } var parameters = new ParameterExpression[0]; // Act var lambda = DynamicExpressionParser.ParseLambda(config, parameters, typeof(double), expression); var result = lambda.Compile().DynamicInvoke(); // Assert result.Should().Be(expected); } public class EntityDbo { public string Name { get; set; } } [Fact] public void your_sha256_hashg() { // Act var expression = DynamicExpressionParser.ParseLambda(typeof(EntityDbo), typeof(bool), "Name == @0", "System.Int32"); var del = expression.Compile(); var result = del.DynamicInvoke(new EntityDbo { Name = "System.Int32" }); // Assert result.Should().Be(true); } [Fact] public void your_sha256_hashpression() { // Act var expression = DynamicExpressionParser.ParseLambda(typeof(EntityDbo), typeof(bool), "Name == \"System.Int32\""); var del = expression.Compile(); var result = del.DynamicInvoke(new EntityDbo { Name = "System.Int32" }); // Assert result.Should().Be(true); } [Fact] public void your_sha256_hashLambdaExpression() { var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(bool), "Property1 == \"test\""); Assert.Equal(typeof(bool), expression.Body.Type); } [Fact] public void your_sha256_hasholeanLambdaExpression() { var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(bool), "Property1 == \"\""); Assert.Equal(typeof(bool), expression.Body.Type); } [Fact] public void your_sha256_hashturnsBooleanLambdaExpression() { var config = new ParsingConfig(); var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(bool), "Property1 == \"\""); Assert.Equal(typeof(bool), expression.Body.Type); } [Fact] public void your_sha256_hasheturnsBooleanLambdaExpression() { // Act var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(bool), string.Format("Property1 == {0}", "\"test \\\"string\"")); var rightValue = ((BinaryExpression)expression.Body).Right.ToString(); Assert.Equal(typeof(bool), expression.Body.Type); Assert.Equal("\"test \"string\"", rightValue); } /// <summary> /// @see path_to_url /// </summary> [Fact(Skip = "Fails on EntityFramework.DynamicLinq.Tests with 'An unexpected exception occurred while binding a dynamic operation'")] public void DynamicExpressionParser_ParseLambda_MultipleLambdas() { var users = new[] { new { name = "Juan", age = 25 }, new { name = "Juan", age = 25 }, new { name = "David", age = 12 }, new { name = "Juan", age = 25 }, new { name = "Juan", age = 4 }, new { name = "Pedro", age = 2 }, new { name = "Juan", age = 25 } }.ToList(); IQueryable query; // One lambda var res1 = "[{\"Key\":{\"name\":\"Juan\"},\"nativeAggregates\":{\"ageSum\":104},\"Grouping\":[{\"name\":\"Juan\",\"age\":25},{\"name\":\"Juan\",\"age\":25},{\"name\":\"Juan\",\"age\":25},{\"name\":\"Juan\",\"age\":4},{\"name\":\"Juan\",\"age\":25}]},{\"Key\":{\"name\":\"David\"},\"nativeAggregates\":{\"ageSum\":12},\"Grouping\":[{\"name\":\"David\",\"age\":12}]},{\"Key\":{\"name\":\"Pedro\"},\"nativeAggregates\":{\"ageSum\":2},\"Grouping\":[{\"name\":\"Pedro\",\"age\":2}]}]"; query = users.AsQueryable(); query = query.GroupBy("new(name as name)", "it"); query = query.Select("new (it.Key as Key, new(it.Sum(x => x.age) as ageSum) as nativeAggregates, it as Grouping)"); Assert.Equal(res1, Newtonsoft.Json.JsonConvert.SerializeObject(query)); // Multiple lambdas var res2 = "[{\"Key\":{\"name\":\"Juan\"},\"nativeAggregates\":{\"ageSum\":0,\"ageSum2\":104},\"Grouping\":[{\"name\":\"Juan\",\"age\":25},{\"name\":\"Juan\",\"age\":25},{\"name\":\"Juan\",\"age\":25},{\"name\":\"Juan\",\"age\":4},{\"name\":\"Juan\",\"age\":25}]},{\"Key\":{\"name\":\"David\"},\"nativeAggregates\":{\"ageSum\":0,\"ageSum2\":12},\"Grouping\":[{\"name\":\"David\",\"age\":12}]},{\"Key\":{\"name\":\"Pedro\"},\"nativeAggregates\":{\"ageSum\":0,\"ageSum2\":2},\"Grouping\":[{\"name\":\"Pedro\",\"age\":2}]}]"; query = users.AsQueryable(); query = query.GroupBy("new(name as name)", "it"); query = query.Select("new (it.Key as Key, new(it.Sum(x => x.age > 25 ? 1 : 0) as ageSum, it.Sum(x => x.age) as ageSum2) as nativeAggregates, it as Grouping)"); Assert.Equal(res2, Newtonsoft.Json.JsonConvert.SerializeObject(query)); } [Fact] public void your_sha256_hashote_ReturnsBooleanLambdaExpression() { // Act var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(bool), string.Format("Property1 == {0}", "\"\\\"test\"")); var rightValue = ((BinaryExpression)expression.Body).Right.ToString(); Assert.Equal(typeof(bool), expression.Body.Type); Assert.Equal("\"\"test\"", rightValue); } [Theory] // #786 [InlineData("Escaped", "\"{\\\"PropertyA\\\":\\\"\\\"}\"")] [InlineData("Verbatim", @"""{\""PropertyA\"":\""\""}""")] // [InlineData("Raw", """"{\"PropertyA\":\"\"}"""")] // TODO : does not work ??? public void DynamicExpressionParser_ParseLambda_StringLiteral_EscapedJson(string _, string expression) { // Act var result = DynamicExpressionParser .ParseLambda(typeof(object), expression) .Compile() .DynamicInvoke(); result.Should().Be("{\"PropertyA\":\"\"}"); } [Fact] public void your_sha256_hashQuote() { var expectedRightValue = "\"test\\\""; Assert.Throws<ParseException>(() => DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(bool), string.Format("Property1 == {0}", expectedRightValue))); } [Fact] public void your_sha256_hashh_ReturnsBooleanLambdaExpression() { // Act var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(bool), string.Format("Property1 == {0}", "\"test\\\\string\"")); var rightValue = ((BinaryExpression)expression.Body).Right.ToString(); Assert.Equal(typeof(Boolean), expression.Body.Type); Assert.Equal("\"test\\string\"", rightValue); } [Fact] public void your_sha256_hashReturnsBooleanLambdaExpression() { // Act var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(bool), string.Format("Property1 == {0}", "\"test\\\\new\"")); var rightValue = ((BinaryExpression)expression.Body).Right.ToString(); Assert.Equal(typeof(Boolean), expression.Body.Type); Assert.Equal("\"test\\new\"", rightValue); } [Fact] public void DynamicExpressionParser_ParseLambda_StringLiteral_Backslash() { // Assign var expectedRightValue = "0"; //Act var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(Boolean), string.Format("{0} >= {1}", "Property1.IndexOf(\"\\\\\")", expectedRightValue)); var leftValue = ((BinaryExpression)expression.Body).Left.ToString(); var rightValue = ((BinaryExpression)expression.Body).Right.ToString(); // Assert Assert.Equal(typeof(Boolean), expression.Body.Type); Assert.Equal("Property1.IndexOf(\"\\\")", leftValue); Assert.Equal(expectedRightValue, rightValue); } [Fact] public void DynamicExpressionParser_ParseLambda_StringLiteral_QuotationMark() { var expectedRightValue = "0"; var expression = DynamicExpressionParser.ParseLambda( new[] { Expression.Parameter(typeof(string), "Property1") }, typeof(Boolean), string.Format("{0} >= {1}", "Property1.IndexOf(\"\\\"\")", expectedRightValue)); var leftValue = ((BinaryExpression)expression.Body).Left.ToString(); var rightValue = ((BinaryExpression)expression.Body).Right.ToString(); Assert.Equal(typeof(Boolean), expression.Body.Type); Assert.Equal("Property1.IndexOf(\"\"\")", leftValue); Assert.Equal(expectedRightValue, rightValue); } [Fact] public void your_sha256_hashrnsStringLambdaExpression() { var expression = DynamicExpressionParser.ParseLambda( typeof(Tuple<int>), typeof(string), "it.ToString()"); Assert.Equal(typeof(string), expression.ReturnType); } [Fact] public void your_sha256_hashIsReturnedByCustomTypeProvider_ShouldWorkCorrect() { // Assign var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; var context = new CustomClassWithStaticMethod(); var expression = $"{nameof(CustomClassWithStaticMethod)}.{nameof(CustomClassWithStaticMethod.GetAge)}(10)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(config, typeof(CustomClassWithStaticMethod), null, expression); var del = lambdaExpression.Compile(); var result = (int)del.DynamicInvoke(context); // Assert Check.That(result).IsEqualTo(10); } [Fact] public void your_sha256_hashHasDynamicLinqTypeAttribute_ShouldWorkCorrect() { // Assign var context = new CustomClassWithStaticMethodWithDynamicLinqTypeAttribute(); var expression = $"{nameof(CustomClassWithStaticMethodWithDynamicLinqTypeAttribute)}.{nameof(CustomClassWithStaticMethodWithDynamicLinqTypeAttribute.GetAge)}(10)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(typeof(CustomClassWithStaticMethodWithDynamicLinqTypeAttribute), null, expression); var del = lambdaExpression.Compile(); var result = (int?)del.DynamicInvoke(context); // Assert Check.That(result).IsEqualTo(10); } [Fact] public void your_sha256_hashamicLinqTypeAttribute_ShouldWorkCorrect() { // Assign var context = new CustomClassWithMethodWithDynamicLinqTypeAttribute(); var expression = $"{nameof(CustomClassWithMethodWithDynamicLinqTypeAttribute.GetAge)}(10)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(typeof(CustomClassWithMethodWithDynamicLinqTypeAttribute), null, expression); var del = lambdaExpression.Compile(); var result = (int?)del.DynamicInvoke(context); // Assert Check.That(result).IsEqualTo(10); } [Fact] public void your_sha256_hasheHasDynamicLinqTypeAttribute_ShouldWorkCorrect() { // Arrange var context = new CustomClassImplementingInterface(); var expression = $"{nameof(ICustomInterfaceWithMethodWithDynamicLinqTypeAttribute.GetAge)}(10)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(typeof(ICustomInterfaceWithMethodWithDynamicLinqTypeAttribute), null, expression); var del = lambdaExpression.Compile(); var result = (int?)del.DynamicInvoke(context); // Assert result.Should().Be(10); } [Fact] public void your_sha256_hashtHaveDynamicLinqTypeAttribute_ShouldThrowException() { // Assign var expression = $"{nameof(CustomClassWithMethod.GetAge)}(10)"; // Act Action action = () => DynamicExpressionParser.ParseLambda(typeof(CustomClassWithMethod), null, expression); // Assert action.Should().Throw<ParseException>().WithMessage("Methods on type 'CustomClassWithMethod' are not accessible"); } // [Fact] public void DynamicExpressionParser_ParseLambda_With_InnerStringLiteral() { // Assign var originalTrueValue = "simple + \"quoted\""; var doubleQuotedTrueValue = "simple + \"\"quoted\"\""; var expressionText = $"iif(1>0, \"{doubleQuotedTrueValue}\", \"false\")"; // Act var lambda = DynamicExpressionParser.ParseLambda(typeof(string), null, expressionText); var del = lambda.Compile(); var result = del.DynamicInvoke(string.Empty); // Assert Check.That(result).IsEqualTo(originalTrueValue); } [Fact] public void DynamicExpressionParser_ParseLambda_With_Guid_Equals_Null() { // Arrange var user = new User(); var guidEmpty = Guid.Empty; var someId = Guid.NewGuid(); var expressionText = $"iif(@0.Id == null, @0.Id == Guid.Parse(\"{someId}\"), Id == Id)"; // Act var lambda = DynamicExpressionParser.ParseLambda(typeof(User), null, expressionText, user); var boolLambda = lambda as Expression<Func<User, bool>>; Assert.NotNull(boolLambda); var del = lambda.Compile(); var result = (bool)del.DynamicInvoke(user); // Assert Assert.True(result); } [Fact] public void DynamicExpressionParser_ParseLambda_With_Null_Equals_Guid() { // Arrange var user = new User(); var someId = Guid.NewGuid(); var expressionText = $"iif(null == @0.Id, @0.Id == Guid.Parse(\"{someId}\"), Id == Id)"; // Act var lambda = DynamicExpressionParser.ParseLambda(typeof(User), null, expressionText, user); var boolLambda = lambda as Expression<Func<User, bool>>; Assert.NotNull(boolLambda); var del = lambda.Compile(); var result = (bool)del.DynamicInvoke(user); // Assert Assert.True(result); } [Fact] public void DynamicExpressionParser_ParseLambda_With_DateTime_Equals_String() { // Arrange var someDateTime = "2022-03-02"; var user = new Person { D = new DateTime(2022, 3, 2) }; var expressionText = $"D == \"{someDateTime}\""; // Act var lambda = DynamicExpressionParser.ParseLambda(typeof(Person), null, expressionText, user); var dtLambda = lambda as Expression<Func<Person, bool>>; Assert.NotNull(dtLambda); var del = lambda.Compile(); var result = (bool)del.DynamicInvoke(user); // Assert Assert.True(result); } [Fact] public void your_sha256_hashs_ToString_Issue675() { // Arrange var expressionText = "DateTime.UtcNow.AddHours(2).ToString(\"o\")"; var parameterExpression = Expression.Parameter(typeof(string)); // Act var lambda = DynamicExpressionParser.ParseLambda(new[] { parameterExpression }, typeof(object), expressionText); // Assert lambda.Should().NotBeNull(); } [Fact] public void DynamicExpressionParser_ParseLambda_With_Guid_Equals_String() { // Arrange var someId = Guid.NewGuid(); var anotherId = Guid.NewGuid(); var user = new User { Id = someId }; var guidEmpty = Guid.Empty; var expressionText = $"iif(@0.Id == \"{someId}\", Guid.Parse(\"{guidEmpty}\"), Guid.Parse(\"{anotherId}\"))"; // Act var lambda = DynamicExpressionParser.ParseLambda(typeof(User), null, expressionText, user); var guidLambda = lambda as Expression<Func<User, Guid>>; Assert.NotNull(guidLambda); var del = lambda.Compile(); var result = (Guid)del.DynamicInvoke(user); // Assert Assert.Equal(guidEmpty, result); } [Fact] public void your_sha256_hashe() { // Arrange var name = "name1"; var note = "note1"; var textHolder = new TextHolder(name, note); var expressionText = "Name + \" (\" + Note + \")\""; // Act 1 var lambda = DynamicExpressionParser.ParseLambda(typeof(TextHolder), null, expressionText, textHolder); var stringLambda = lambda as Expression<Func<TextHolder, string>>; // Assert 1 Assert.NotNull(stringLambda); // Act 2 var del = lambda.Compile(); var result = (string)del.DynamicInvoke(textHolder); // Assert 2 Assert.Equal("name1 (note1)", result); } [Fact] public void your_sha256_hashg() { // Arrange var name = "name1"; var note = "note1"; var textHolder = new TextHolder(name, note); var expressionText = "Note + \" (\" + Name + \")\""; // Act 1 var lambda = DynamicExpressionParser.ParseLambda(typeof(TextHolder), null, expressionText, textHolder); var stringLambda = lambda as Expression<Func<TextHolder, string>>; // Assert 1 Assert.NotNull(stringLambda); // Act 2 var del = lambda.Compile(); var result = (string)del.DynamicInvoke(textHolder); // Assert 2 Assert.Equal("note1 (name1)", result); } [Fact] public void your_sha256_hashsions() { // Arrange var testString = "test"; var testInt = 6; var container = new TestImplicitConversionContainer(testString, new CustomClassWithReversedImplicitConversion(testString), testInt, new CustomClassWithReversedValueTypeImplicitConversion(testInt)); var expressionTextString = $"OneWay == \"{testString}\""; var expressionTextReversed = $"Reversed == \"{testString}\""; var expressionTextValueType = $"ValueType == {testInt}"; var expressionTextReversedValueType = $"ReversedValueType == {testInt}"; var invertedExpressionTextString = $"\"{testString}\" == OneWay"; var invertedExpressionTextReversed = $"\"{testString}\" == Reversed"; var invertedExpressionTextValueType = $"{testInt} == ValueType"; var invertedExpressionTextReversedValueType = $"{testInt} == ReversedValueType"; // Act 1 var lambda = DynamicExpressionParser.ParseLambda<TestImplicitConversionContainer, bool>(ParsingConfig.Default, false, expressionTextString); // Assert 1 Assert.NotNull(lambda); // Act 2 lambda = DynamicExpressionParser.ParseLambda<TestImplicitConversionContainer, bool>(ParsingConfig.Default, false, expressionTextReversed); // Assert 2 Assert.NotNull(lambda); // Act 3 lambda = DynamicExpressionParser.ParseLambda<TestImplicitConversionContainer, bool>(ParsingConfig.Default, false, expressionTextValueType); // Assert 3 Assert.NotNull(lambda); // Act 4 lambda = DynamicExpressionParser.ParseLambda<TestImplicitConversionContainer, bool>(ParsingConfig.Default, false, expressionTextReversedValueType); // Assert 4 Assert.NotNull(lambda); // Act 5 lambda = DynamicExpressionParser.ParseLambda<TestImplicitConversionContainer, bool>(ParsingConfig.Default, false, invertedExpressionTextString); // Assert 5 Assert.NotNull(lambda); // Act 6 lambda = DynamicExpressionParser.ParseLambda<TestImplicitConversionContainer, bool>(ParsingConfig.Default, false, invertedExpressionTextReversed); // Assert 6 Assert.NotNull(lambda); // Act 7 lambda = DynamicExpressionParser.ParseLambda<TestImplicitConversionContainer, bool>(ParsingConfig.Default, false, invertedExpressionTextValueType); // Assert 7 Assert.NotNull(lambda); // Act 8 lambda = DynamicExpressionParser.ParseLambda<TestImplicitConversionContainer, bool>(ParsingConfig.Default, false, invertedExpressionTextReversedValueType); // Assert 8 Assert.NotNull(lambda); } [Fact] public void your_sha256_hashyWithSameNameAsNormalProperty() { // Arrange var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; var user = new User { Id = new Guid("854f6ac8-71f9-4f79-8cd7-3ca46eaa02e6") }; var expressionText = "Id == System.Linq.Dynamic.Core.Tests.Helpers.Models.UserInfo.Key"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionText); var boolExpression = (Expression<Func<User, bool>>)lambdaExpression; var del = boolExpression.Compile(); var result = (bool?)del.DynamicInvoke(user); // Assert result.Should().Be(false); } [Fact] public void your_sha256_hashy() { // Arrange var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; var user = new User { Id = new Guid("854f6ac8-71f9-4f79-8cd7-3ca46eaa02e6") }; var expressionText = "Id == StaticHelper.NewStaticGuid"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionText); var boolExpression = (Expression<Func<User, bool>>)lambdaExpression; var del = boolExpression.Compile(); var result = (bool?)del.DynamicInvoke(user); // Assert result.Should().Be(false); } [Fact] public void your_sha256_hashroperty() { // Arrange var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; var user = new User { Id = new Guid("854f6ac8-71f9-4f79-8cd7-3ca46eaa02e6") }; var expressionText = "Id == StaticHelper.Nested.NewNestedStaticProperty"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionText); var boolExpression = (Expression<Func<User, bool>>)lambdaExpression; var del = boolExpression.Compile(); var result = (bool?)del.DynamicInvoke(user); // Assert result.Should().Be(false); } [Fact] public void your_sha256_hashethod() { // Arrange var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; var user = new User { Id = new Guid("854f6ac8-71f9-4f79-8cd7-3ca46eaa02e6") }; var expressionText = "Id == StaticHelper.Nested.NewNestedStaticMethod()"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionText); var boolExpression = (Expression<Func<User, bool>>)lambdaExpression; var del = boolExpression.Compile(); var result = (bool?)del.DynamicInvoke(user); // Assert result.Should().Be(false); } [Fact] public void your_sha256_hashuids() { var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; // Arrange var someId = Guid.NewGuid(); var anotherId = Guid.NewGuid(); var user = new User { Id = someId }; var guidEmpty = Guid.Empty; var expressionText = $"iif(@0.Id == StaticHelper.GetGuid(\"name\"), Guid.Parse(\"{guidEmpty}\"), Guid.Parse(\"{anotherId}\"))"; // Act var lambda = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionText, user); var guidLambda = (Expression<Func<User, Guid>>)lambda; var del = guidLambda.Compile(); var result = (Guid?)del.DynamicInvoke(user); // Assert result.Should().Be(anotherId); } [Fact] public void your_sha256_hashssionString() { // Arrange var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; var user = new User(); // Act : char var expressionTextChar = "StaticHelper.Filter(\"C == 'c'\")"; var lambdaChar = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionTextChar, user); var funcChar = (Expression<Func<User, string>>)lambdaChar; var delegateChar = funcChar.Compile(); var resultChar = (string?)delegateChar.DynamicInvoke(user); // Assert : int resultChar.Should().Be("C == 'c'"); // Act : int var expressionTextIncome = "StaticHelper.Filter(\"Income == 5\")"; var lambdaIncome = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionTextIncome, user); var funcIncome = (Expression<Func<User, string>>)lambdaIncome; var delegateIncome = funcIncome.Compile(); var resultIncome = (string?)delegateIncome.DynamicInvoke(user); // Assert : int resultIncome.Should().Be("Income == 5"); // Act : string // Replace " with \" // Replace \" with \\\" StaticHelper.Filter("UserName == \"x\""); var expressionTextUserName = "StaticHelper.Filter(\"UserName == \\\"x\\\"\")"; var lambdaUserName = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionTextUserName, user); var funcUserName = (Expression<Func<User, string>>)lambdaUserName; var delegateUserName = funcUserName.Compile(); var resultUserName = (string?)delegateUserName.DynamicInvoke(user); // Assert : string resultUserName.Should().Be(@"UserName == ""x"""); // Act : string // Replace " with \" // Replace \" with \"\" var configNonDefault = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider(), StringLiteralParsing = StringLiteralParsingType.EscapeDoubleQuoteByTwoDoubleQuotes }; expressionTextUserName = "StaticHelper.Filter(\"UserName == \"\"x\"\"\")"; lambdaUserName = DynamicExpressionParser.ParseLambda(configNonDefault, typeof(User), null, expressionTextUserName, user); funcUserName = (Expression<Func<User, string>>)lambdaUserName; delegateUserName = funcUserName.Compile(); resultUserName = (string?)delegateUserName.DynamicInvoke(user); // Assert : string resultUserName.Should().Be(@"UserName == ""x"""); } [Fact] public void your_sha256_hashexExpressionString() { // Arrange var config = new ParsingConfig { CustomTypeProvider = new TestCustomTypeProvider() }; var user = new User(); // Replace " with \" // Replace \" with \\\" var _ = StaticHelper.In(Guid.NewGuid(), StaticHelper.SubSelect("Identity", "LegalPerson", "StaticHelper.In(ParentId, StaticHelper.SubSelect( \"LegalPersonId\", \"PointSiteTD\", \"Identity = 5\", \"\")) ", "")); var expressionText = "StaticHelper.In(Id, StaticHelper.SubSelect(\"Identity\", \"LegalPerson\", \"StaticHelper.In(ParentId, StaticHelper.SubSelect(\\\"LegalPersonId\\\", \\\"PointSiteTD\\\", \\\"Identity = 5\\\", \\\"\\\"))\", \"\"))"; // Act var lambda = DynamicExpressionParser.ParseLambda(config, typeof(User), null, expressionText, user); var func = (Expression<Func<User, bool>>)lambda; var compile = func.Compile(); var result = (bool?)compile.DynamicInvoke(user); // Assert result.Should().Be(false); } [Theory] [InlineData(true, "c => c.Age == 8", "c => (c.Age == 8)")] [InlineData(true, "c => c.Name == \"test\"", "c => (c.Name == \"test\")")] [InlineData(false, "c => c.Age == 8", "Param_0 => (Param_0.Age == 8)")] [InlineData(false, "c => c.Name == \"test\"", "Param_0 => (Param_0.Name == \"test\")")] public void DynamicExpressionParser_ParseLambda_RenameParameterExpression(bool renameParameterExpression, string expressionAsString, string expected) { // Arrange var config = new ParsingConfig { RenameParameterExpression = renameParameterExpression }; // Act var expression = DynamicExpressionParser.ParseLambda<ComplexParseLambda1Result, bool>(config, true, expressionAsString); var result = expression.ToString(); // Assert Check.That(result).IsEqualTo(expected); } [Theory] [InlineData("c => c.Age == 8", "([a-z]{16}) =\\> \\(\\1\\.Age == 8\\)")] [InlineData("c => c.Name == \"test\"", "([a-z]{16}) =\\> \\(\\1\\.Name == \"test\"\\)")] public void your_sha256_hashonNames(string expressionAsString, string expected) { // Arrange var config = new ParsingConfig { RenameEmptyParameterExpressionNames = true }; // Act var expression = DynamicExpressionParser.ParseLambda<ComplexParseLambda1Result, bool>(config, true, expressionAsString); var result = expression.ToString(); // Assert Check.That(result).Matches(expected); } [Theory] [InlineData(@"p0.Equals(""Testing"", 3)", "testinG", true)] [InlineData(@"p0.Equals(""Testing"", StringComparison.InvariantCultureIgnoreCase)", "testinG", true)] public void DynamicExpressionParser_ParseLambda_StringEquals(string expressionAsString, string testValue, bool expectedResult) { // Arrange var p0 = Expression.Parameter(typeof(string), "p0"); // Act var expression = DynamicExpressionParser.ParseLambda(new[] { p0 }, typeof(bool), expressionAsString); var del = expression.Compile(); var result = del.DynamicInvoke(testValue) as bool?; // Assert Check.That(result).IsEqualTo(expectedResult); } // #799 [Theory] [InlineData(@"UserName.Equals(""Testing"", 3) and Income > 0")] [InlineData(@"UserName.Equals(""Testing"", StringComparison.InvariantCultureIgnoreCase) and Income > 0")] [InlineData(@"Income > 0 && UserName.Equals(""Testing"", 3)")] [InlineData(@"Income > 0 && UserName.Equals(""Testing"", StringComparison.InvariantCultureIgnoreCase)")] public void your_sha256_hashdition(string expressionAsString) { // Arrange var u = Expression.Parameter(typeof(User), "u"); // Act var expression = DynamicExpressionParser.ParseLambda(new[] { u }, typeof(bool), expressionAsString); var del = expression.Compile(); var result = del.DynamicInvoke(new User { UserName = "testinG", Income = 10 }) as bool?; // Assert Check.That(result).IsEqualTo(true); } // #803 [Fact] public void your_sha256_hashring() { // Arrange var parameters = new[] { Expression.Parameter(typeof(MyClass), "myClass") }; var invokerArguments = new object[] { new MyClass { Name = "Foo" } }; // Act var expression = "Name == \"test\" || Name.ToLower() == \"abc\" or \"foo\".Equals(it.Name, StringComparison.OrdinalIgnoreCase)"; var lambdaExpression = DynamicExpressionParser.ParseLambda(parameters, null, expression); var del = lambdaExpression.Compile(); var result = del.DynamicInvoke(invokerArguments); // Assert result.Should().Be(true); } // #810 [Fact] public void DynamicExpressionParser_ParseLambda_Calling_ToLower_On_String() { // Arrange var parameters = new[] { Expression.Parameter(typeof(MyClass), "myClass") }; var invokerArguments = new object[] { new MyClass { Name = "Foo", Description = "Bar" } }; // Act var expression = "(Name != null && Convert.ToString(Name).ToLower().Contains(\"foo\")) or (Description != null && Convert.ToString(Description).ToLower().Contains(\"bar\"))"; var lambdaExpression = DynamicExpressionParser.ParseLambda(parameters, null, expression); var del = lambdaExpression.Compile(); var result = del.DynamicInvoke(invokerArguments); // Assert result.Should().Be(true); } [Fact] public void your_sha256_hashg() { // Arrange var parameters = new[] { Expression.Parameter(typeof(MyClass), "myClass") }; var invokerArguments = new List<object> { new MyClass { Name = "Foo" } }; // Act var expression = "Name == \"test\" || Name.Equals(\"foo\", StringComparison.OrdinalIgnoreCase)"; var lambdaExpression = DynamicExpressionParser.ParseLambda(parameters, null, expression); var del = lambdaExpression.Compile(); var result = del.DynamicInvoke(invokerArguments.ToArray()); // Assert result.Should().Be(true); } [Fact] public void your_sha256_hashod_0_Arguments() { // Arrange var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>(); customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(Foo) }); var config = new ParsingConfig { CustomTypeProvider = customTypeProvider.Object }; var expression = "np(FooValue.Zero().Length)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(config, typeof(Foo), null, expression, new Foo()); // Assert #if NETCOREAPP3_1_OR_GREATER || NET6_0_OR_GREATER lambdaExpression.ToString().Should().Be("Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.FooValue != null)) AndAlso (Param_0.FooValue.Zero() != null)), Convert(Param_0.FooValue.Zero().Length, Nullable`1), null)"); #else lambdaExpression.ToString().Should().Be("Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.FooValue != null)) AndAlso (Param_0.FooValue.Zero() != null)), Convert(Param_0.FooValue.Zero().Length), null)"); #endif } [Fact] public void your_sha256_hashod_1_Argument() { // Arrange var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>(); customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(Foo) }); var config = new ParsingConfig { CustomTypeProvider = customTypeProvider.Object }; var expression = "np(FooValue.One(1).Length)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(config, typeof(Foo), null, expression, new Foo()); // Assert #if NETCOREAPP3_1_OR_GREATER || NET6_0_OR_GREATER lambdaExpression.ToString().Should().Be("Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.FooValue != null)) AndAlso (Param_0.FooValue.One(1) != null)), Convert(Param_0.FooValue.One(1).Length, Nullable`1), null)"); #else lambdaExpression.ToString().Should().Be("Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.FooValue != null)) AndAlso (Param_0.FooValue.One(1) != null)), Convert(Param_0.FooValue.One(1).Length), null)"); #endif } [Fact] public void your_sha256_hashod_2_Arguments() { // Arrange var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>(); customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(Foo) }); var config = new ParsingConfig { CustomTypeProvider = customTypeProvider.Object }; var expression = "np(FooValue.Two(1, 42).Length)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(config, typeof(Foo), null, expression, new Foo()); // Assert #if NETCOREAPP3_1_OR_GREATER || NET6_0_OR_GREATER lambdaExpression.ToString().Should().Be("Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.FooValue != null)) AndAlso (Param_0.FooValue.Two(1, 42) != null)), Convert(Param_0.FooValue.Two(1, 42).Length, Nullable`1), null)"); #else lambdaExpression.ToString().Should().Be("Param_0 => IIF((((Param_0 != null) AndAlso (Param_0.FooValue != null)) AndAlso (Param_0.FooValue.Two(1, 42) != null)), Convert(Param_0.FooValue.Two(1, 42).Length), null)"); #endif } [Fact] public void your_sha256_hashpression() { // Arrange var myClass = new MyClass(); var dataSource = new { MyClasses = new[] { myClass, null } }; var expressionText = "np(MyClasses.FirstOrDefault())"; // Act var expression = DynamicExpressionParser.ParseLambda(ParsingConfig.Default, dataSource.GetType(), typeof(MyClass), expressionText); var del = expression.Compile(); var result = del.DynamicInvoke(dataSource) as MyClass; // Assert result.Should().Be(myClass); } [Theory] [InlineData("np(MyClasses.FirstOrDefault().Name)")] [InlineData("np(MyClasses.FirstOrDefault(Name == \"a\").Name)")] public void your_sha256_hashpression_With_Property(string expressionText) { // Arrange var dataSource = new MyClass(); // Act var expression = DynamicExpressionParser.ParseLambda(ParsingConfig.Default, dataSource.GetType(), typeof(string), expressionText); var del = expression.Compile(); var result = del.DynamicInvoke(dataSource) as string; // Assert result.Should().BeNull(); } [Fact] public void your_sha256_hashlExpression() { // Arrange var dataSource = new MyClass(); var expressionText = "it.Bar()"; var parsingConfig = new ParsingConfig { CustomTypeProvider = new MyClassCustomTypeProvider() }; dataSource.Name.Should().BeNull(); // Act var expression = DynamicExpressionParser.ParseLambda(typeof(Action<MyClass>), parsingConfig, dataSource.GetType(), null, expressionText); var del = expression.Compile(); del.DynamicInvoke(dataSource); // Assert dataSource.Name.Should().NotBeNullOrEmpty(); } [Fact] public void DynamicExpressionParser_ParseLambda_String_TrimEnd_0_Parameters() { // Act var expression = DynamicExpressionParser.ParseLambda<string, bool>(new ParsingConfig(), false, "TrimEnd().EndsWith(@0)", "test"); var @delegate = expression.Compile(); var result = (bool)@delegate.DynamicInvoke("This is a test "); // Assert result.Should().BeTrue(); } [Fact] public void DynamicExpressionParser_ParseLambda_String_TrimEnd_1_Parameter() { // Act var expression = DynamicExpressionParser.ParseLambda<string, bool>(new ParsingConfig(), false, "TrimEnd('.').EndsWith(@0)", "test"); var @delegate = expression.Compile(); var result = (bool)@delegate.DynamicInvoke("This is a test..."); // Assert result.Should().BeTrue(); } [Fact] public void DynamicExpressionParser_ParseLambda_GenericExtensionMethod() { // Arrange var testList = User.GenerateSampleModels(51); var config = new ParsingConfig { CustomTypeProvider = new DefaultDynamicLinqCustomTypeProviderForGenericExtensionMethod(), PrioritizePropertyOrFieldOverTheType = true }; // Act var query = "x => MethodsItemExtension.Functions.EfCoreCollate(x.UserName, \"tlh-KX\")==\"User4\" || MethodsItemExtension.Functions.EfCoreCollate(x.UserName, \"tlh-KX\")==\"User2\""; var expression = DynamicExpressionParser.ParseLambda<User, bool>(config, false, query); var del = expression.Compile(); var result = Enumerable.Where(testList, del); var expected = testList.Where(x => new string[] { "User4", "User2" }.Contains(x.UserName)).ToList(); // Assert Check.That(result).IsNotNull(); Check.That(result).HasSize(expected.Count); Check.That(result).Equals(expected); } [Fact] public void DynamicExpressionParser_ParseLambda_Action() { // Arrange var action = (Action<int>)DynamicExpressionParser.ParseLambda(typeof(Action<int>), new[] { Expression.Parameter(typeof(int), "x") }, typeof(int), "x + 1").Compile(); // Act action(3); } [Fact] public void DynamicExpressionParser_ParseLambda_Func() { // Arrange var func = (Func<int, int>)DynamicExpressionParser.ParseLambda( typeof(Func<int, int>), new[] { Expression.Parameter(typeof(int), "x") }, typeof(int), "x + 1" ).Compile(); // Act var result = func(4); // Assert result.Should().Be(5); } [Theory] [InlineData("value", "value != null && value == 1", 1, true)] [InlineData("value", "value != null && value == 1", 5, false)] [InlineData("x", "value != null && value == 1", 1, true)] [InlineData("x", "value != null && value == 1", 5, false)] [InlineData(null, "value != null && value == 1", 1, true)] [InlineData(null, "value != null && value == 1", 5, false)] [InlineData("value", "value => value != null && value == 1", 1, true)] [InlineData("value", "value => value != null && value == 1", 5, false)] public void DynamicExpressionParser_ParseLambda_Func2(string? paramName, string test, int? input, bool expected) { // Arrange var nullableType = typeof(int?); var delegateType = typeof(Func<,>).MakeGenericType(nullableType, typeof(bool)); var valueParameter = paramName is not null ? Expression.Parameter(nullableType, paramName) : Expression.Parameter(nullableType); // Act 1 var expression = DynamicExpressionParser.ParseLambda( delegateType, new ParsingConfig(), new[] { valueParameter }, typeof(bool), test ); // Act 2 var compiledExpression = expression.Compile(); var result = compiledExpression.DynamicInvoke(input); // Assert result.Should().Be(expected); } [Fact] public void your_sha256_hash_String() { // Arrange var cc = "firstValue".ToCharArray(); var field = new { Name = "firstName", Value = new string(cc) }; var props = new DynamicProperty[] { new DynamicProperty(field.Name, typeof(string)) }; var type = DynamicClassFactory.CreateType(props); var dynamicClass = (DynamicClass)Activator.CreateInstance(type); dynamicClass.SetDynamicPropertyValue(field.Name, field.Value); // Act 1 var parameters = new[] { Expression.Parameter(type, "x") }; var expression = DynamicExpressionParser.ParseLambda(null, new ParsingConfig(), true, parameters, null, "firstName eq \"firstValue\""); var @delegate = expression.Compile(); var result = (bool)@delegate.DynamicInvoke(dynamicClass); // Assert 1 result.Should().BeTrue(); // Arrange 2 var array = new[] { field }.AsQueryable(); // Act 2 var isValid = array.Select("it").Any("Value eq \"firstValue\""); // Assert 2 isValid.Should().BeTrue(); } [Fact] public void your_sha256_hashJoin() { // Arrange var strArray = new[] { "a", "b", "c" }; var parameterExpressions = new List<ParameterExpression> { Expression.Parameter(strArray.GetType(), "strArray") }; var expression = "string.Join(\",\", strArray)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(parameterExpressions.ToArray(), null, expression); var @delegate = lambdaExpression.Compile(); var result = (string)@delegate.DynamicInvoke(new object[] { strArray }); // Assert result.Should().Be("a,b,c"); } [Fact] public void your_sha256_hashJoin() { // Arrange var objectArray = new object[] { 1, 2, 3 }; var parameterExpressions = new List<ParameterExpression> { Expression.Parameter(objectArray.GetType(), "objectArray") }; var expression = "string.Join(\",\", objectArray)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(parameterExpressions.ToArray(), null, expression); var @delegate = lambdaExpression.Compile(); var result = (string)@delegate.DynamicInvoke(new object[] { objectArray }); // Assert result.Should().Be("1,2,3"); } [Fact] public void your_sha256_hashn() { // Arrange var intArray = new[] { 1, 2, 3 }; var parameterExpressions = new List<ParameterExpression> { Expression.Parameter(intArray.GetType(), "intArray") }; var expression = "string.Join(\",\", intArray)"; // Act var lambdaExpression = DynamicExpressionParser.ParseLambda(parameterExpressions.ToArray(), null, expression); var @delegate = lambdaExpression.Compile(); var result = (string)@delegate.DynamicInvoke(intArray); // Assert result.Should().Be("1,2,3"); } [Fact] public void your_sha256_hashnamicType() { // Act DynamicExpressionParser.ParseLambda<bool>(new ParsingConfig(), false, "new[]{1,2,3}.Any(z => z > 0)"); } public class DefaultDynamicLinqCustomTypeProviderForGenericExtensionMethod : DefaultDynamicLinqCustomTypeProvider { public DefaultDynamicLinqCustomTypeProviderForGenericExtensionMethod() : base(ParsingConfig.Default) { } public override HashSet<Type> GetCustomTypes() => new HashSet<Type>(base.GetCustomTypes()) { typeof(Methods), typeof(MethodsItemExtension) }; } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/DynamicExpressionParserTests.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
16,152
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_Average() { // Act double expected = _context.Blogs.Select(b => b.BlogId).Average(); double actual = _context.Blogs.Select("BlogId").Average(); // Assert Assert.Equal(expected, actual); } [Fact] public void Entities_Average_Selector() { // Act double expected = _context.Blogs.Average(b => b.BlogId); double actual = _context.Blogs.Average("BlogId"); // Assert Assert.Equal(expected, actual); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Average.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
177
```smalltalk using System.Collections; using System.Collections.Generic; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using FluentAssertions; using Newtonsoft.Json.Linq; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void SelectMany_Dynamic() { // Act var users = User.GenerateSampleModels(2); users[0].Roles = new List<Role> { new Role { Name = "Admin", Permissions = new List<Permission> {new Permission {Name = "p-Admin"}, new Permission {Name = "p-User"}} } }; users[1].Roles = new List<Role> { new Role {Name = "Guest", Permissions = new List<Permission> {new Permission {Name = "p-Guest"}}} }; var query = users.AsQueryable(); // Assign var queryNormal = query.SelectMany(u => u.Roles.SelectMany(r => r.Permissions)).Select(p => p.Name).ToList(); var queryDynamic = query.SelectMany("Roles.SelectMany(Permissions)").Select("Name").ToDynamicList<string>(); // Assert Assert.Equal(queryNormal, queryDynamic); } /// <summary> /// path_to_url and path_to_url /// </summary> [Fact] public void SelectMany_Dynamic_OverArray() { var testList = new[] { new[] {1}, new[] {1, 2}, new[] {1, 2, 3}, new[] {1, 2, 3, 4}, new[] {1, 2, 3, 4, 5} }; var expectedResult = testList.SelectMany(it => it).ToList(); var result = testList.AsQueryable().SelectMany("it").ToDynamicList<int>(); Assert.Equal(expectedResult, result); } [Fact] public void SelectMany_TResult() { // Act var users = User.GenerateSampleModels(2); users[0].Roles = new List<Role> { new Role { Name = "Admin", Permissions = new List<Permission> {new Permission {Name = "p-Admin"}, new Permission {Name = "p-User"}} } }; users[1].Roles = new List<Role> { new Role {Name = "Guest", Permissions = new List<Permission> {new Permission {Name = "p-Guest"}}} }; var query = users.AsQueryable(); // Assign var queryNormal = query.SelectMany(u => u.Roles.SelectMany(r => r.Permissions)).ToList(); var queryDynamic = query.SelectMany<Permission>("Roles.SelectMany(Permissions)").ToDynamicList(); // Assert Assert.Equal(queryNormal, queryDynamic); } [Fact] public void SelectMany_Dynamic_IntoType() { // Act var users = User.GenerateSampleModels(2); users[0].Roles = new List<Role> { new Role { Name = "Admin", Permissions = new List<Permission> {new Permission {Name = "p-Admin"}, new Permission {Name = "p-User"}} } }; users[1].Roles = new List<Role> { new Role {Name = "Guest", Permissions = new List<Permission> {new Permission {Name = "p-Guest"}}} }; var query = users.AsQueryable(); // Assign var queryNormal = query.SelectMany(u => u.Roles.SelectMany(r => r.Permissions)).ToList(); var queryDynamic = query.SelectMany(typeof(Permission), "Roles.SelectMany(Permissions)").ToDynamicList(); // Assert Assert.Equal(queryNormal, queryDynamic); } [Fact] public void SelectMany_Dynamic_OverJArray_TResult() { // Arrange var array1 = JArray.Parse("[1,2,3]"); var array2 = JArray.Parse("[4,5,6]"); // Act var expectedResult = new[] { array1, array2 }.SelectMany(it => it).ToArray(); var result = new[] { array1, array2 }.AsQueryable().SelectMany("it").ToDynamicArray<JToken>(); // Assert result.Should().BeEquivalentTo(expectedResult); // result.Should().HaveCount(6).And.Subject.Select(j => j.Value).Should().ContainInOrder(new[] { 1, 2, 3, 4, 5, 6 }); } [Fact] public void SelectMany_Dynamic_OverArray_TResult() { var testList = new[] { new[] {new Permission {Name = "p-Admin"}}, new[] {new Permission {Name = "p-Admin"}, new Permission {Name = "p-User"}}, new[] {new Permission {Name = "p-x"}, new Permission {Name = "p-y"}} }; var expectedResult = testList.SelectMany(it => it).ToList(); var result = testList.AsQueryable().SelectMany<Permission>("it").ToList(); Assert.Equal(expectedResult, result); } [Fact] public void SelectMany_Dynamic_OverArray_Int() { var testList = new[] { new[] { 1, 2, 3 }, new[] { 4, 5, 6 } }; var expectedResult = testList.SelectMany(it => it).ToList(); var result = testList.AsQueryable().SelectMany<int>("it").ToList(); Assert.Equal(expectedResult, result); } [Fact] public void SelectMany_Dynamic_OverArray_IntoType() { var testList = new[] { new[] {new Permission {Name = "p-Admin"}}, new[] {new Permission {Name = "p-Admin"}, new Permission {Name = "p-User"}}, new[] {new Permission {Name = "p-x"}, new Permission {Name = "p-y"}} }; var expectedResult = testList.SelectMany(it => it).ToList(); var result = testList.AsQueryable().SelectMany(typeof(Permission), "it").ToDynamicList<Permission>(); Assert.Equal(expectedResult, result); } [Fact] public void SelectMany_Dynamic_WithResultProjection() { //Arrange List<int> rangeOfInt = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; List<double> rangeOfDouble = new List<double> { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 }; List<KeyValuePair<int, double>> range = rangeOfInt.SelectMany(e => rangeOfDouble, (x, y) => new KeyValuePair<int, double>(x, y)).ToList(); //Act IEnumerable rangeResult = rangeOfInt.AsQueryable() .SelectMany("@0", "new(x as _A, y as _B)", new object[] { rangeOfDouble }) .Select("it._A * it._B"); //Assert Assert.Equal(range.Select(t => t.Key * t.Value).ToArray(), rangeResult.Cast<double>().ToArray()); } [Fact] public void SelectMany_Dynamic_WithResultProjection_CustomParameterNames() { //Arrange List<int> rangeOfInt = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; List<double> rangeOfDouble = new List<double> { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 }; List<KeyValuePair<int, double>> range = rangeOfInt.SelectMany(e => rangeOfDouble, (x, y) => new KeyValuePair<int, double>(x, y)).ToList(); //Act IEnumerable rangeResult = rangeOfInt.AsQueryable() .SelectMany("@0", "new(VeryNiceName as _A, OtherName as _X)", "VeryNiceName", "OtherName", new object[] { rangeOfDouble }) .Select("it._A * it._X"); //Assert Assert.Equal(range.Select(t => t.Key * t.Value).ToArray(), rangeResult.Cast<double>().ToArray()); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.SelectMany.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
1,851
```smalltalk using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq.Dynamic.Core.Exceptions; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using FluentAssertions; using Linq.PropertyTranslator.Core; using QueryInterceptor.Core; using Xunit; using NFluent; using Newtonsoft.Json.Linq; #if AspNetCoreIdentity using Microsoft.AspNetCore.Identity; #else using Microsoft.AspNet.Identity.EntityFramework; #endif namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { public class Example { public int Field; public DateTime Time { get; set; } public DateTime? TimeNull { get; set; } public DayOfWeek? DOWNull { get; set; } public DayOfWeek DOW { get; set; } public int Sec { get; set; } public int? SecNull { get; set; } public class NestedDto { public string Name { get; set; } public class NestedDto2 { public string Name2 { get; set; } } } } public class ExampleWithConstructor { public DateTime Time { get; set; } public DayOfWeek? DOWNull { get; set; } public DayOfWeek DOW { get; set; } public int Sec { get; set; } public int? SecNull { get; set; } // public long X { get; set; } public ExampleWithConstructor(DateTime t, DayOfWeek? dn, DayOfWeek d, int s, int? sn) { Time = t; DOWNull = dn; DOW = d; Sec = s; SecNull = sn; } } public class ExampleWithConstructor2 { public int? Value { get; set; } public ExampleWithConstructor2(bool b) { } public ExampleWithConstructor2(int? value) { Value = value; } } /// <summary> /// Cannot work with property which in base class. path_to_url /// </summary> [Fact] public void Select_Dynamic_PropertyInBaseClass() { var queryable = new[] { new IdentityUser("a"), new IdentityUser("b") }.AsQueryable(); var expected = queryable.Select(i => i.Id); var dynamic = queryable.Select<string>("Id"); Assert.Equal(expected.ToArray(), dynamic.ToArray()); } [Fact] public void Select_Dynamic_As_WithDot() { // Assign var qry = User.GenerateSampleModels(1).AsQueryable(); var config = new ParsingConfig { SupportDotInPropertyNames = true }; // Act var result = qry.Select(config, "new (Profile.FirstName as P.FirstName)").ToDynamicArray(); // Assert result.Should().HaveCount(1); } [Fact] public void Select_Dynamic1() { // Assign var qry = User.GenerateSampleModels(1).AsQueryable(); // Act var userRoles1 = qry.Select("new (Roles.Select(Id) as RoleIds)"); var userRoles2 = qry.Select("new (Roles.Select(it.Id) as RoleIds)"); // Assert Check.That(userRoles1.Count()).IsEqualTo(1); Check.That(userRoles2.Count()).IsEqualTo(1); } [Fact] public void Select_Dynamic2() { // Assign var qry = User.GenerateSampleModels(1).AsQueryable(); // Act var userRoles = qry.Select("new (Roles.Select(it).ToArray() as Rolez)"); // Assert Check.That(userRoles.Count()).IsEqualTo(1); } [Fact] public void Select_Dynamic3() { //Arrange List<int> range = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var testList = User.GenerateSampleModels(100); var qry = testList.AsQueryable(); //Act IEnumerable rangeResult = range.AsQueryable().Select("it * it"); var userNames = qry.Select("UserName"); var userFirstName = qry.Select("new (UserName, Profile.FirstName as MyFirstName)"); var userRoles = qry.Select("new (UserName, Roles.Select(Id) AS RoleIds)"); //Assert Assert.Equal(range.Select(x => x * x).ToArray(), rangeResult.Cast<int>().ToArray()); #if NET35 Assert.Equal(testList.Select(x => x.UserName).ToArray(), userNames.AsEnumerable().Cast<string>().ToArray()); Assert.Equal( testList.Select(x => "{ UserName = " + x.UserName + ", MyFirstName = " + x.Profile.FirstName + " }").ToArray(), userFirstName.Cast<object>().Select(x => x.ToString()).ToArray()); Assert.Equal(testList[0].Roles.Select(x => x.Id).ToArray(), Enumerable.ToArray(userRoles.First().GetDynamicProperty<IEnumerable<Guid>>("RoleIds"))); #else Assert.Equal(testList.Select(x => x.UserName).ToArray(), userNames.Cast<string>().ToArray()); Assert.Equal( testList.Select(x => "{ UserName = " + x.UserName + ", MyFirstName = " + x.Profile.FirstName + " }").ToArray(), userFirstName.AsDynamicEnumerable().Select(x => x.ToString()).Cast<string>().ToArray()); Assert.Equal(testList[0].Roles.Select(x => x.Id).ToArray(), Enumerable.ToArray(userRoles.First().RoleIds)); #endif } [Fact] public void Select_Dynamic_Add_Integers() { // Arrange var range = new List<int> { 1, 2 }; // Act IEnumerable rangeResult = range.AsQueryable().Select("it + 1"); // Assert Assert.Equal(range.Select(x => x + 1).ToArray(), rangeResult.Cast<int>().ToArray()); } [Fact] public void Select_Dynamic_Add_Strings() { // Arrange var range = new List<string> { "a", "b" }; // Act IEnumerable rangeResult = range.AsQueryable().Select("it + \"c\""); // Assert Assert.Equal(range.Select(x => x + "c").ToArray(), rangeResult.Cast<string>().ToArray()); } [Fact] public void Select_Dynamic_WithIncludes() { // Arrange var qry = new List<Entities.Employee>().AsQueryable(); // Act string includesX = ", it.Company as TEntity__Company, it.Company.MainCompany as TEntity__Company_MainCompany, it.Country as TEntity__Country, it.Function as TEntity__Function, it.SubFunction as TEntity__SubFunction"; string select = $"new (\"__Key__\" as __Key__, it AS TEntity__{includesX})"; var userNames = qry.Select(select).ToDynamicList(); // Assert Assert.NotNull(userNames); } [Fact] public void Select_Dynamic_WithPropertyVisitorAndQueryInterceptor() { var testList = new List<Entities.Employee> { new Entities.Employee {FirstName = "first", LastName = "last"} }; var qry = testList.AsEnumerable().AsQueryable().InterceptWith(new PropertyVisitor()); var dynamicSelect = qry.Select("new (FirstName, LastName, FullName)").ToDynamicList(); Assert.NotNull(dynamicSelect); Assert.Single(dynamicSelect); var firstEmployee = dynamicSelect.FirstOrDefault(); Assert.NotNull(firstEmployee); Assert.Equal("first last", firstEmployee.FullName); } [Fact] public void Select_Dynamic_TResult() { //Arrange List<int> range = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var testList = User.GenerateSampleModels(100); var qry = testList.AsQueryable(); //Act IEnumerable rangeResult = range.AsQueryable().Select<int>("it * it").ToList(); var userNames = qry.Select<string>("UserName").ToList(); var userProfiles = qry.Select<UserProfile>("Profile").ToList(); //Assert Assert.Equal(range.Select(x => x * x).ToList(), rangeResult); Assert.Equal(testList.Select(x => x.UserName).ToList(), userNames); Assert.Equal(testList.Select(x => x.Profile).ToList(), userProfiles); } [Fact] public void Select_Dynamic_IntoType() { //Arrange List<int> range = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var testList = User.GenerateSampleModels(10); var qry = testList.AsQueryable(); //Act IEnumerable rangeResult = range.AsQueryable().Select(typeof(int), "it * it"); var userNames = qry.Select(typeof(string), "UserName"); var userProfiles = qry.Select(typeof(UserProfile), "Profile"); //Assert Assert.Equal(range.Select(x => x * x).Cast<object>().ToList(), rangeResult.ToDynamicList()); Assert.Equal(testList.Select(x => x.UserName).Cast<object>().ToList(), userNames.ToDynamicList()); Assert.Equal(testList.Select(x => x.Profile).Cast<object>().ToList(), userProfiles.ToDynamicList()); } [Fact] public void Select_Dynamic_IntoTypeWithNullableProperties1() { // Arrange var dates = Enumerable.Repeat(0, 7) .Select((d, i) => new DateTime(2000, 1, 1).AddDays(i).AddSeconds(i)) .AsQueryable(); var config = new ParsingConfig { SupportEnumerationsFromSystemNamespace = false }; // Act IQueryable<Example> result = dates .Select(d => new Example { Time = d, DOWNull = d.DayOfWeek, DOW = d.DayOfWeek, Sec = d.Second, SecNull = d.Second }); IQueryable<Example> resultDynamic = dates .Select<Example>(config, "new (it as Time, DayOfWeek as DOWNull, DayOfWeek as DOW, Second as Sec, int?(Second) as SecNull)"); // Assert Check.That(resultDynamic.First()).Equals(result.First()); Check.That(resultDynamic.Last()).Equals(result.Last()); } [Fact] public void Select_Dynamic_IntoTypeWithNullableProperties2() { // Arrange var dates = Enumerable.Repeat(0, 7) .Select((d, i) => new DateTime(2000, 1, 1).AddDays(i).AddSeconds(i)) .AsQueryable(); var config = new ParsingConfig { SupportEnumerationsFromSystemNamespace = false }; // Act IQueryable<ExampleWithConstructor> result = dates .Select(d => new ExampleWithConstructor(d, d.DayOfWeek, d.DayOfWeek, d.Second, d.Second)); IQueryable<ExampleWithConstructor> resultDynamic = dates .Select<ExampleWithConstructor>(config, "new (it as Time, DayOfWeek as DOWNull, DayOfWeek as DOW, Second as Sec, int?(Second) as SecNull)"); // Assert Check.That(resultDynamic.First()).Equals(result.First()); Check.That(resultDynamic.Last()).Equals(result.Last()); } [Fact] public void Select_Dynamic_IntoTypeWithNullableParameterInConstructor() { // Arrange var values = Enumerable.Repeat(0, 3).AsQueryable(); var config = new ParsingConfig { AllowNewToEvaluateAnyType = true }; // Act var result = values.Select(v => new ExampleWithConstructor2(v)); var resultDynamic = values.Select<ExampleWithConstructor2>(config, "new (it as value)"); // Assert Check.That(resultDynamic.First()).Equals(result.First()); Check.That(resultDynamic.Last()).Equals(result.Last()); } [Fact] public void Select_Dynamic_SystemType1() { // Arrange var config = new ParsingConfig { AllowNewToEvaluateAnyType = true }; var queryable = new[] { "test" }.AsQueryable(); // Act var result = queryable.Select(config, $"new {typeof(DirectoryInfo).FullName}(~ as path)").ToDynamicArray().First(); // Assert Assert.NotNull(result); Assert.Equal(result.Name, "test"); } [Fact] public void Select_Dynamic_SystemType2() { // Arrange var config = new ParsingConfig { AllowNewToEvaluateAnyType = true }; var queryable = new[] { "test" }.AsQueryable(); // Act var result = queryable.Select<DirectoryInfo>(config, "new (~ as path)").ToDynamicArray().First(); // Assert Assert.NotNull(result); Assert.Equal(result.Name, "test"); } [Fact] public void Select_Dynamic_WithField() { // Arrange var config = new ParsingConfig { AllowNewToEvaluateAnyType = true }; var queryable = new List<int> { 1, 2 }.AsQueryable(); // Act var projectedData = queryable.Select<Example>(config, $"new {typeof(Example).FullName}(~ as Field)"); // Assert Check.That(projectedData.First().Field).Equals(1); Check.That(projectedData.Last().Field).Equals(2); } [Fact] public void Select_Dynamic_IntoKnownNestedType() { // Arrange var config = new ParsingConfig { AllowNewToEvaluateAnyType = true }; var queryable = new List<string> { "name1", "name2" }.AsQueryable(); // Act var projectedData = queryable.Select<Example.NestedDto>(config, $"new {typeof(Example.NestedDto).FullName}(~ as Name)"); // Assert Check.That(projectedData.First().Name).Equals("name1"); Check.That(projectedData.Last().Name).Equals("name2"); } [Fact] public void Select_Dynamic_IntoKnownNestedTypeSecondLevel() { // Arrange var config = new ParsingConfig { AllowNewToEvaluateAnyType = true }; var queryable = new List<string> { "name1", "name2" }.AsQueryable(); // Act var projectedData = queryable.Select<Example.NestedDto.NestedDto2>(config, $"new {typeof(Example.NestedDto.NestedDto2).FullName}(~ as Name2)"); // Assert Check.That(projectedData.First().Name2).Equals("name1"); Check.That(projectedData.Last().Name2).Equals("name2"); } [Fact] public void Select_Dynamic_RenameParameterExpression_Is_False() { // Arrange var config = new ParsingConfig { RenameParameterExpression = false }; var queryable = new int[0].AsQueryable(); // Act string result = queryable.Select<int>(config, "it * it").ToString(); // Assert Check.That(result).Equals("System.Int32[].Select(Param_0 => (Param_0 * Param_0))"); } [Fact] public void Select_Dynamic_RenameParameterExpression_Is_True() { // Arrange var config = new ParsingConfig { RenameParameterExpression = true }; var queryable = new int[0].AsQueryable(); // Act string result = queryable.Select<int>(config, "it * it").ToString(); // Assert Check.That(result).Equals("System.Int32[].Select(it => (it * it))"); } #if NET461 || NET5_0 || NET6_0 || NET7_0 || NET8_0 [Fact(Skip = "Fails sometimes in GitHub CI build")] #else [Fact] #endif public void Select_Dynamic_JObject_With_Array_Should_Use_Correct_Indexer() { // Arrange var j = new JObject { {"I", new JValue(9)}, {"A", new JArray(new[] {1,2,3}) }, {"L", new JValue(5)} }; var queryable = new[] { j }.AsQueryable(); // Act var result = queryable.Select("new (long(I) as I, (new [] { long(A[0]), long(A[1]), long(A[2])}) as A, long(L) as L)").ToDynamicArray().First(); // Assert Assert.Equal(9, result.I); Assert.Equal(5, result.L); Assert.Equal(1, result.A[0]); Assert.Equal(2, result.A[1]); Assert.Equal(3, result.A[2]); } [Fact] public void Select_Dynamic_ReservedKeyword() { // Arrange var queryable = new[] { new { Id = 1, Guid = "a" } }.AsQueryable(); // Act var result = queryable.Select("new (Id, @Guid, 42 as Answer)").ToDynamicArray(); // Assert Check.That(result).IsNotNull(); } [Fact] public void Select_Dynamic_Exceptions() { //Arrange var testList = User.GenerateSampleModels(100, allowNullableProfiles: true); var qry = testList.AsQueryable(); //Act Assert.Throws<ParseException>(() => qry.Select("Bad")); Assert.Throws<ParseException>(() => qry.Select("Id, UserName")); Assert.Throws<ParseException>(() => qry.Select("new Id, UserName")); Assert.Throws<ParseException>(() => qry.Select("new (Id, UserName")); Assert.Throws<ParseException>(() => qry.Select("new (Id, UserName, Bad)")); Check.ThatCode(() => qry.Select<User>("new User(it.Bad as Bad)")).Throws<ParseException>().WithMessage("No property or field 'Bad' exists in type 'User'"); Assert.Throws<ArgumentNullException>(() => DynamicQueryableExtensions.Select(null, "Id")); Assert.Throws<ArgumentNullException>(() => qry.Select(null)); Assert.Throws<ArgumentException>(() => qry.Select("")); Assert.Throws<ArgumentException>(() => qry.Select(" ")); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Select.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
3,915
```smalltalk using NFluent; using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void DefaultIfEmpty() { // Arrange var queryable = User.GenerateSampleModels(1).AsQueryable(); // Act var result = queryable.DefaultIfEmpty(); var expected = queryable.DefaultIfEmpty(); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void DefaultIfEmpty_Dynamic() { // Arrange var queryable = User.GenerateSampleModels(1).AsQueryable(); // Act var expected = queryable.Select(u => u.Roles.Where(r => r.Name == "Admin").DefaultIfEmpty().FirstOrDefault()).ToDynamicArray<object>(); var result = queryable.Select("it.Roles.Where(r => r.Name == \"Admin\").DefaultIfEmpty().FirstOrDefault()").ToDynamicArray<object>(); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void DefaultIfEmpty_Empty() { // Arrange var queryable = User.GenerateSampleModels(1).Where(u => u.Income == -5).AsQueryable(); // Act var result = queryable.DefaultIfEmpty(); var expected = queryable.DefaultIfEmpty(); // Assert Check.That(result).IsNotNull(); Check.That(expected).IsNotNull(); } [Fact] public void DefaultIfEmpty_Empty_Dynamic() { // Arrange var queryable = User.GenerateSampleModels(1).AsQueryable(); // Act var expected = queryable.Select(u => u.Roles.Where(r => r.Name == "a").DefaultIfEmpty().FirstOrDefault()).ToDynamicArray<object>(); var result = queryable.Select("it.Roles.Where(r => r.Name == \"a\").DefaultIfEmpty().FirstOrDefault()").ToDynamicArray<object>(); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void DefaultIfEmpty_WithDefaultValue() { // Arrange var user = new User(); var queryable = User.GenerateSampleModels(1).AsQueryable(); // Act var result = queryable.DefaultIfEmpty(user); var expected = queryable.DefaultIfEmpty(user); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void DefaultIfEmpty_WithDefaultValue_Dynamic() { // Arrange var role = new Role { Name = "?" }; var queryable = User.GenerateSampleModels(1).AsQueryable(); // Act var expected = queryable.Select(u => u.Roles.Where(r => r.Name == "Admin").DefaultIfEmpty(role).FirstOrDefault()).ToDynamicArray<object>(); var result = queryable.Select("it.Roles.Where(r => r.Name == \"Admin\").DefaultIfEmpty(@0).FirstOrDefault()", role).ToDynamicArray<object>(); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void DefaultIfEmpty_Empty_WithDefaultValue() { // Arrange var user = new User { Income = 42 }; var queryable = User.GenerateSampleModels(1).Where(u => u.Income == -5).AsQueryable(); // Act var result = queryable.DefaultIfEmpty(user); var expected = queryable.DefaultIfEmpty(user); // Assert Check.That(result).ContainsExactly(expected); } [Fact] public void DefaultIfEmpty_Empty_WithDefaultValue_Dynamic() { // Arrange var role = new Role { Name = "?" }; var queryable = User.GenerateSampleModels(1).AsQueryable(); // Act var expected = queryable.Select(u => u.Roles.Where(r => r.Name == "a").DefaultIfEmpty(role).FirstOrDefault()).ToDynamicArray<object>(); var result = queryable.Select("it.Roles.Where(r => r.Name == \"a\").DefaultIfEmpty(@0).FirstOrDefault()", role).ToDynamicArray<object>(); // Assert Check.That(result).ContainsExactly(expected); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.DefaultIfEmpty.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
887
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void First() { //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var result = testListQry.First(); //Assert #if NET35 Assert.Equal(testList[0].Id, result.GetDynamicProperty<Guid>("Id")); #else Assert.Equal(testList[0].Id, result.Id); #endif } [Fact] public void First_Predicate() { //Arrange var testList = User.GenerateSampleModels(100); var queryable = testList.AsQueryable(); //Act var expected = queryable.First(u => u.Income > 1000); var result = queryable.First("Income > 1000"); //Assert Assert.Equal(expected as object, result); } [Fact] public void First_Predicate_WithArgs() { const int value = 1000; //Arrange var testList = User.GenerateSampleModels(100); var queryable = testList.AsQueryable(); //Act var expected = queryable.First(u => u.Income > value); var result = queryable.First("Income > @0", value); //Assert Assert.Equal(expected as object, result); } [Fact] public void First_Dynamic() { //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var realResult = testList.OrderBy(x => x.Roles.First().Name).Select(x => x.Id).ToArray(); var testResult = testListQry.OrderBy("Roles.First().Name").Select("Id"); //Assert #if NET35 || NETSTANDARD Assert.Equal(realResult, testResult.Cast<Guid>().ToArray()); #else Assert.Equal(realResult, testResult.ToDynamicArray().Cast<Guid>()); #endif } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.First.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
456
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public void Entities_Sum_Integer() { // Arrange var expected = _context.Blogs.Select(b => b.BlogId).Sum(); // Act var actual = _context.Blogs.Select("BlogId").Sum(); // Assert Assert.Equal(expected, actual); } [Fact] public void Entities_Sum_Double() { // Arrange var expected = _context.Blogs.Select(b => b.BlogId * 1.0d).Sum(); // Act var actual = _context.Blogs.Select("BlogId * 1.0").Sum(); // Assert Assert.Equal(expected, actual); } [Fact] public void Entities_Sum_Integer_Selector() { // Arrange var expected = _context.Blogs.Sum(b => b.BlogId); // Act var actual = _context.Blogs.Sum("BlogId"); // Assert Assert.Equal(expected, actual); } [Fact] public void Entities_Sum_Double_Selector() { // Arrange var expected = _context.Blogs.Sum(b => b.BlogId * 1.0d); // Act var actual = _context.Blogs.Sum("BlogId * 1.0d"); // Assert Assert.Equal(expected, actual); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.Sum.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
342
```smalltalk using Linq.PropertyTranslator.Core; using LinqKit; using NFluent; using QueryInterceptor.Core; using System.Linq.Dynamic.Core.Tests.Helpers.Entities; using Xunit; #if EFCORE using Microsoft.EntityFrameworkCore; #else using System.Data.Entity; #endif namespace System.Linq.Dynamic.Core.Tests; public class DefaultQueryableAnalyzerTests : IClassFixture<EntitiesTestsDatabaseFixture> { private readonly IQueryableAnalyzer _queryableAnalyzer; private readonly BlogContext _context; public DefaultQueryableAnalyzerTests(EntitiesTestsDatabaseFixture fixture) { #if EFCORE var builder = new DbContextOptionsBuilder(); if (fixture.UseInMemory) { builder.UseInMemoryDatabase($"System.Linq.Dynamic.Core.{Guid.NewGuid()}"); } else { builder.UseSqlServer(fixture.ConnectionString); } _context = new BlogContext(builder.Options); #else _context = new BlogContext(fixture.ConnectionString); #endif _queryableAnalyzer = new DefaultQueryableAnalyzer(); } [Fact] public void DefaultQueryableAnalyzer_SupportsLinqToObjects_ObjectQuery() { // Assign var query = new[] { 1, 2 }.AsQueryable().Where(x => x > 0); // Act bool result = _queryableAnalyzer.SupportsLinqToObjects(query); // Assert Check.That(result).IsTrue(); } [Fact] public void your_sha256_hashQueryInterceptor() { // Assign var query = new[] { 1, 2 }.AsQueryable().Where(x => x > 0).InterceptWith(new PropertyVisitor()); // Act bool result = _queryableAnalyzer.SupportsLinqToObjects(query); // Assert Check.That(result).IsTrue(); } [Fact] public void your_sha256_hashExpandableQuery() { // Assign var query = new[] { 1, 2 }.AsQueryable().Where(x => x > 0).AsExpandable(); // Act bool result = _queryableAnalyzer.SupportsLinqToObjects(query); // Assert Check.That(result).IsTrue(); } [Fact] public void DefaultQueryableAnalyzer_SupportsLinqToObjects_EntitiesQuery() { // Assign var query = _context.Blogs.Where(b => b.BlogId > 0); // Act bool result = _queryableAnalyzer.SupportsLinqToObjects(query); // Assert Check.That(result).IsFalse(); } [Fact] public void your_sha256_hashh_QueryInterceptor() { // Assign var query = _context.Blogs.Where(b => b.BlogId > 0).InterceptWith(new PropertyVisitor()); // Act bool result = _queryableAnalyzer.SupportsLinqToObjects(query); // Assert Check.That(result).IsFalse(); } [Fact] public void your_sha256_hashh_ExpandableQuery() { // Assign var query = _context.Blogs.Where(b => b.BlogId > 0).AsExpandable(); // Act bool result = _queryableAnalyzer.SupportsLinqToObjects(query); // Assert Check.That(result).IsFalse(); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/DefaultQueryableAnalyzerTests.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
697
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void SkipWhile_Predicate() { //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var expected = testList.SkipWhile(u => u.Income > 1000); var result = testListQry.SkipWhile("Income > 1000"); //Assert Assert.Equal(expected.ToArray(), result.Cast<User>().ToArray()); } [Fact] public void SkipWhile_Predicate_Args() { const int income = 1000; //Arrange var testList = User.GenerateSampleModels(100); IQueryable testListQry = testList.AsQueryable(); //Act var expected = testList.SkipWhile(u => u.Income > income); var result = testListQry.SkipWhile("Income > @0", income); //Assert Assert.Equal(expected.ToArray(), result.Cast<User>().ToArray()); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.SkipWhile.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
242
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore.DynamicLinq; #else using EntityFramework.DynamicLinq; #endif using System.Threading.Tasks; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public async Task Entities_FirstOrDefaultAsync() { // Arrange var expectedQueryable1 = _context.Blogs.Where(b => b.Name == "SingleBlog"); var expected1 = await expectedQueryable1.FirstOrDefaultAsync(); // Act var result1 = await _context.Blogs.Where("Name == \"SingleBlog\"").FirstOrDefaultAsync(); var result2 = await _context.Blogs.Where("Name == \"NotFound\"").FirstOrDefaultAsync(); // Assert Assert.Equal(expected1, result1); Assert.Null(result2); } [Fact] public async Task Entities_FirstOrDefaultAsync_Predicate() { // Arrange #if EFCORE var expected1 = await Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.FirstOrDefaultAsync(_context.Blogs, b => b.Name == "SingleBlog"); #else var expected1 = await System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(_context.Blogs, b => b.Name == "SingleBlog"); #endif // Act var result1 = await _context.Blogs.AsQueryable().FirstOrDefaultAsync("Name == \"SingleBlog\""); var result2 = await _context.Blogs.AsQueryable().FirstOrDefaultAsync("Name == \"NotFound\""); // Assert Assert.Equal(expected1, result1); Assert.Null(result2); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.FirstOrDefaultAsync.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
320
```smalltalk using System.Linq.Dynamic.Core.Tests.Helpers.Models; using Xunit; namespace System.Linq.Dynamic.Core.Tests { public partial class QueryableTests { [Fact] public void Page() { //Arrange const int total = 35; const int page = 2; const int pageSize = 10; var testList = User.GenerateSampleModels(total); IQueryable testListQry = testList.AsQueryable(); //Act var result = testListQry.Page(page, pageSize); //Assert Assert.Equal(testList.Skip((page - 1) * pageSize).Take(pageSize).ToArray(), result.ToDynamicArray<User>()); } [Fact] public void Page_TSource() { //Arrange const int total = 35; const int page = 2; const int pageSize = 10; var testList = User.GenerateSampleModels(total); var testListQry = testList.AsQueryable(); //Act var result = testListQry.Page(page, pageSize); //Assert Assert.Equal(testList.Skip((page - 1) * pageSize).Take(pageSize).ToArray(), result.ToDynamicArray<User>()); } [Fact] public void PageResult() { //Arrange const int total = 44; const int page = 2; const int pageSize = 10; var testList = User.GenerateSampleModels(total); IQueryable testListQry = testList.AsQueryable(); //Act var result = testListQry.PageResult(page, pageSize); //Assert Assert.Equal(page, result.CurrentPage); Assert.Equal(pageSize, result.PageSize); Assert.Equal(total, result.RowCount); Assert.Equal(5, result.PageCount); Assert.Equal(testList.Skip((page - 1) * pageSize).Take(pageSize).ToArray(), result.Queryable.ToDynamicArray<User>()); } [Fact] public void PageResult_TSource() { //Arrange const int total = 44; const int page = 2; const int pageSize = 10; var testList = User.GenerateSampleModels(total); var testListQry = testList.AsQueryable(); //Act var result = testListQry.PageResult(page, pageSize); //Assert Assert.Equal(page, result.CurrentPage); Assert.Equal(pageSize, result.PageSize); Assert.Equal(total, result.RowCount); Assert.Equal(5, result.PageCount); Assert.Equal(testList.Skip((page - 1) * pageSize).Take(pageSize).ToArray(), result.Queryable.ToDynamicArray<User>()); } } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Page.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
566
```smalltalk #if EFCORE using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.DynamicLinq; #else using System.Data.Entity; using EntityFramework.DynamicLinq; #endif using System.Linq.Expressions; using System.Threading.Tasks; using System.Linq.Dynamic.Core.Tests.Helpers.Entities; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class EntitiesTests { [Fact] public async Task Entities_LongCountAsync_Predicate_Args() { // Arrange const string search = "a"; Expression<Func <Blog, bool>> predicate = b => b.Name.Contains(search); #if EFCORE var expected = await EntityFrameworkQueryableExtensions.LongCountAsync(_context.Blogs, predicate); #else var expected = await QueryableExtensions.LongCountAsync(_context.Blogs, predicate); #endif //Act long result = (_context.Blogs as IQueryable).LongCount("Name.Contains(@0)", search); //Assert Assert.Equal(expected, result); } } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.LongCountAsync.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
202
```smalltalk using System.Collections.Generic; using FluentAssertions; using Xunit; namespace System.Linq.Dynamic.Core.Tests; public partial class QueryableTests { /// <summary> /// Issue #645 /// </summary> [Fact] public void your_sha256_hashueForDateTime_Should_Be_Unwrapped() { // Arrange var list = new List<Customer> { new() { Name = "Terri Lee Duffy", CompanyName = "ABC", City = "Paris", Phone = "333-444444", Location = new Location { Name = "test" }, LastContact = DateTimeOffset.Parse("2022-11-14") }, new() { Name = "Garry Moore", CompanyName = "ABC", City = "Paris", Phone = "54654-444444", Location = new Location { Name = "other test", UpdateAt = DateTimeOffset.Parse("2022-11-16") }, LastContact = DateTimeOffset.Parse("2022-11-16") } }; var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act 1A var result1A = list.AsQueryable().Where(config, "LastContact = \"2022-11-16\"").ToArray(); // Assert 1A result1A.Should().HaveCount(1); // Act 1B var result1B = list.AsQueryable().Where(config, "\"2022-11-16\" == LastContact").ToArray(); // Assert 1B result1B.Should().HaveCount(1); // Act 2A var result2A = list.AsQueryable().Where("Location.UpdateAt = \"2022-11-16\"").ToArray(); // Assert 2A result2A.Should().HaveCount(1); // Act 2B var result2B = list.AsQueryable().Where("\"2022-11-16\" == Location.UpdateAt").ToArray(); // Assert 2B result2B.Should().HaveCount(1); } /// <summary> /// Issue #668 /// </summary> [Fact] public void your_sha256_hashueEnum_Should_Be_Unwrapped() { // Arrange var list = new List<Customer> { new() { Name = "Duffy", GenderType = Gender.Female }, new() { Name = "Garry", GenderType = Gender.Male } }; var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act var result = list.AsQueryable().Where(config, "GenderType = \"Female\"").ToArray(); // Assert result.Should().HaveCount(1); } [Fact] public void your_sha256_hashueEnumAsParameter_Should_Be_Unwrapped() { // Arrange var list = new List<Customer> { new() { Name = "Duffy", GenderType = Gender.Female }, new() { Name = "Garry", GenderType = Gender.Male } }; var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act var result = list.AsQueryable().Where(config, "GenderType = @0", "Female").ToArray(); // Assert result.Should().HaveCount(1); } [Fact] public void your_sha256_hashueEnumArray_Should_Be_Unwrapped() { // Arrange var list = new List<Customer> { new() { Name = "Duffy", GenderType = Gender.Female }, new() { Name = "Garry", GenderType = Gender.Male }, new() { Name = "Garry", GenderType = Gender.Other }, new() { Name = "Garry", GenderType = Gender.Male } }; var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act var result = list.AsQueryable().Where(config, "GenderType in (\"Female\", \"Other\")").ToArray(); // Assert result.Should().HaveCount(2); } [Fact] public void your_sha256_hashlueEnumArray_Should_Be_Unwrapped() { // Arrange var list = new List<Customer> { new() { Name = "Duffy", GenderType = Gender.Female }, new() { Name = "Garry", GenderType = Gender.Male }, new() { Name = "Test A", GenderType = Gender.Other }, new() { Name = "Test B", GenderType = Gender.Male } }; var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act var result = list.AsQueryable().Where(config, "GenderType in (0, 2)").ToArray(); // Assert result.Should().HaveCount(3); } [Fact] public void your_sha256_hashlueEnum_Should_Be_Unwrapped() { // Arrange var list = new List<Customer> { new() { Name = "Duffy", GenderType = Gender.Female }, new() { Name = "Garry", GenderType = Gender.Male } }; var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act var result = list.AsQueryable().Where(config, "GenderType = 1").ToArray(); // Assert result.Should().HaveCount(1); } [Fact] public void your_sha256_hashringValueEnumAsParameter_Should_Be_Unwrapped() { // Arrange var list = new List<Customer> { new() { Name = "Duffy", GenderType = Gender.Female }, new() { Name = "Garry", GenderType = Gender.Male } }; var config = new ParsingConfig { UseParameterizedNamesInDynamicQuery = true }; // Act var result = list.AsQueryable().Where(config, "GenderType = @0", 1).ToArray(); // Assert result.Should().HaveCount(1); } } public class Customer { public int CustomerID { get; set; } public string Name { get; set; } public string CompanyName { get; set; } public string City { get; set; } public string Phone { get; set; } public Location Location { get; set; } public DateTimeOffset? LastContact { get; set; } public Gender GenderType { get; set; } } public class Location { public int LocationID { get; set; } public string Name { get; set; } public DateTimeOffset UpdateAt { get; set; } } public enum Gender { Male = 0, Female = 1, Other = 2 } ```
/content/code_sandbox/test/System.Linq.Dynamic.Core.Tests/QueryableTests.UseParameterizedNamesInDynamicQuery .cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
1,600