Skip to content

Commit acbfa49

Browse files
committed
wip - delete later
1 parent 63da894 commit acbfa49

File tree

19 files changed

+1267
-115
lines changed

19 files changed

+1267
-115
lines changed

example/Dto/UserDto.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,18 @@ public record UserDto
1313
public int? NullableInt { get; set; }
1414
public DateTime DateOfBirthUtc { get; set; }
1515
public DateTime DateOfBirthTz { get; set; }
16+
public AddressDto? BillingAddress { get; set; }
17+
}
18+
19+
public record AddressDto
20+
{
21+
public string Postcode { get; set; } = string.Empty;
22+
public string AddressLine1 { get; set; } = string.Empty;
23+
public CityDto? City { get; set; }
24+
}
25+
26+
public record CityDto
27+
{
28+
public string Name { get; set; } = string.Empty;
29+
public string County { get; set; } = string.Empty;
1630
}

example/Entities/User.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,20 @@ public record User
1616

1717
[Column(TypeName = "timestamp without time zone")]
1818
public DateTime DateOfBirthTz { get; set; }
19+
public Address? BillingAddress { get; set; }
20+
}
21+
22+
public record Address
23+
{
24+
public Guid Id { get; set; }
25+
public string Postcode { get; set; } = string.Empty;
26+
public string AddressLine1 { get; set; } = string.Empty;
27+
public City? City { get; set; }
28+
}
29+
30+
public record City
31+
{
32+
public Guid Id { get; set; }
33+
public string Name { get; set; } = string.Empty;
34+
public string County { get; set; } = string.Empty;
1935
}

example/Profiles/AutoMapperProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ public class AutoMapperProfile : Profile
55
public AutoMapperProfile()
66
{
77
CreateMap<User, UserDto>();
8+
CreateMap<Address, AddressDto>();
9+
CreateMap<City, CityDto>();
810
}
911
}

example/Program.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@
5050

5151
u.DateOfBirthUtc = date;
5252
u.DateOfBirthTz = TimeZoneInfo.ConvertTimeFromUtc(date, timeZone);
53+
})
54+
.RuleFor(x => x.BillingAddress, f => new Address
55+
{
56+
Postcode = f.Address.ZipCode(),
57+
AddressLine1 = f.Address.StreetAddress(),
58+
City = new City
59+
{
60+
Name = f.Address.City(),
61+
County = f.Address.County()
62+
}
5363
});
5464

5565
context.Users.AddRange(users.Generate(1_000));
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public sealed class QueryLambdaExpression : QueryExpression
2+
{
3+
public string CollectionPath { get; set; }
4+
public string LambdaOperator { get; set; } // "any" or "all"
5+
public string Parameter { get; set; } // "x" in any(x: ...)
6+
public QueryExpression Body { get; set; } // The expression inside the lambda
7+
8+
public QueryLambdaExpression(Token token, string collectionPath, string lambdaOperator, string parameter) : base(token)
9+
{
10+
CollectionPath = collectionPath;
11+
LambdaOperator = lambdaOperator;
12+
Parameter = parameter;
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public sealed class PropertyPathExpression : QueryExpression
2+
{
3+
public string[] Path { get; set; }
4+
5+
public PropertyPathExpression(Token token, string[] path) : base(token)
6+
{
7+
Path = path;
8+
}
9+
10+
public string GetPath()
11+
{
12+
return string.Join("/", Path);
13+
}
14+
}

0 commit comments

Comments
 (0)