Skip to content

Commit eafefb9

Browse files
committed
Add lookup example
1 parent 0e48392 commit eafefb9

File tree

6 files changed

+136
-1
lines changed

6 files changed

+136
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-ef": {
6+
"version": "9.0.9",
7+
"commands": [
8+
"dotnet-ef"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

AspNetCore/Razor-Mvc/Razor.AdvancedSearch/EqDemo.AspNetCoreRazor.AdvancedSearch.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<UserSecretsId>EqDemo.AspNetCoreRazor.AdvancedSearch</UserSecretsId>
55
<NoWin32Manifest>true</NoWin32Manifest>
66
<TypeScriptCompileBlocked>True</TypeScriptCompileBlocked>
7+
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
78
</PropertyGroup>
89
<ItemGroup>
910
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.2" />

AspNetCore/Razor-Mvc/Razor.AdvancedSearch/EqDemo.AspNetCoreRazor.AdvancedSearch.csproj.user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
</PropertyGroup>
66
<PropertyGroup>
77
<ActiveDebugProfile>EqDemo.AspNetCoreRazor.AdvancedSearch</ActiveDebugProfile>
8+
<NameOfLastUsedPublishProfile>C:\Projects\EasyQuery\DotNetSamples\AspNetCore\Razor-Mvc\Razor.AdvancedSearch\Properties\PublishProfiles\KorzhCom-Demo-WebApp - Web Deploy.pubxml</NameOfLastUsedPublishProfile>
89
</PropertyGroup>
910
</Project>
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"metadata": {
5+
"_dependencyType": "compute.appService.windows"
6+
},
7+
"parameters": {
8+
"resourceGroupName": {
9+
"type": "string",
10+
"defaultValue": "Gazda-RG",
11+
"metadata": {
12+
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
13+
}
14+
},
15+
"resourceGroupLocation": {
16+
"type": "string",
17+
"defaultValue": "northeurope",
18+
"metadata": {
19+
"description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
20+
}
21+
},
22+
"resourceName": {
23+
"type": "string",
24+
"defaultValue": "KorzhCom-Demo-WebApp",
25+
"metadata": {
26+
"description": "Name of the main resource to be created by this template."
27+
}
28+
},
29+
"resourceLocation": {
30+
"type": "string",
31+
"defaultValue": "[parameters('resourceGroupLocation')]",
32+
"metadata": {
33+
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
34+
}
35+
}
36+
},
37+
"variables": {
38+
"appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
39+
"appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
40+
},
41+
"resources": [
42+
{
43+
"type": "Microsoft.Resources/resourceGroups",
44+
"name": "[parameters('resourceGroupName')]",
45+
"location": "[parameters('resourceGroupLocation')]",
46+
"apiVersion": "2019-10-01"
47+
},
48+
{
49+
"type": "Microsoft.Resources/deployments",
50+
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
51+
"resourceGroup": "[parameters('resourceGroupName')]",
52+
"apiVersion": "2019-10-01",
53+
"dependsOn": [
54+
"[parameters('resourceGroupName')]"
55+
],
56+
"properties": {
57+
"mode": "Incremental",
58+
"template": {
59+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
60+
"contentVersion": "1.0.0.0",
61+
"resources": [
62+
{
63+
"location": "[parameters('resourceLocation')]",
64+
"name": "[parameters('resourceName')]",
65+
"type": "Microsoft.Web/sites",
66+
"apiVersion": "2015-08-01",
67+
"tags": {
68+
"[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
69+
},
70+
"dependsOn": [
71+
"[variables('appServicePlan_ResourceId')]"
72+
],
73+
"kind": "app",
74+
"properties": {
75+
"name": "[parameters('resourceName')]",
76+
"kind": "app",
77+
"httpsOnly": true,
78+
"reserved": false,
79+
"serverFarmId": "[variables('appServicePlan_ResourceId')]",
80+
"siteConfig": {
81+
"metadata": [
82+
{
83+
"name": "CURRENT_STACK",
84+
"value": "dotnetcore"
85+
}
86+
]
87+
}
88+
},
89+
"identity": {
90+
"type": "SystemAssigned"
91+
}
92+
},
93+
{
94+
"location": "[parameters('resourceLocation')]",
95+
"name": "[variables('appServicePlan_name')]",
96+
"type": "Microsoft.Web/serverFarms",
97+
"apiVersion": "2015-08-01",
98+
"sku": {
99+
"name": "S1",
100+
"tier": "Standard",
101+
"family": "S",
102+
"size": "S1"
103+
},
104+
"properties": {
105+
"name": "[variables('appServicePlan_name')]"
106+
}
107+
}
108+
]
109+
}
110+
}
111+
}
112+
]
113+
}

AspNetCore/Razor-Mvc/Razor.AdvancedSearch/Startup.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
110110
var attr = manager.Model.FindEntityAttr("Order.ShipRegion");
111111
attr.Operations.RemoveByIDs(manager.Model, "StartsWith,Contains");
112112
attr.DefaultEditor = new CustomListValueEditor("Lookup", "Lookup");
113+
114+
var catNameAttr = manager.Model.FindEntityAttr("Category.CategoryName");
115+
var catIdAttr = manager.Model.FindEntityAttr("Product.Category");
116+
catIdAttr.Entity.Attributes.Add(catNameAttr);
117+
catNameAttr.UseInConditions = false;
118+
catIdAttr.UseInResult = false;
119+
catIdAttr.LookupAttr = catNameAttr;
113120
});
114121

115122
options.UseSqlFormats(FormatType.Sqlite, formats => {

AspNetCore/Razor-Mvc/Razor.AdvancedSearch/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"AllowedHosts": "*",
99
"ConnectionStrings": {
10-
"EqDemoDb": "Data Source=eqdemo-sqlite.db",
10+
"EqDemoDb": "Data Source=eqdemo-sqlite.db"
1111
//"EqDemoDb": "Server=(localdb)\\MSSQLLocalDB;Database=EqDemo.AspNetCore.AdvancedSearch"
1212
},
1313
"EasyQuery": {

0 commit comments

Comments
 (0)