Skip to content

Commit

Permalink
Make Sample app actual (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpreyskurantov authored Apr 2, 2024
1 parent 82aba9a commit 87dd3d8
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 1,137 deletions.
6 changes: 1 addition & 5 deletions net/Sample/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;

namespace Sample.Controllers {
public class HomeController : Controller {
Expand Down
2 changes: 0 additions & 2 deletions net/Sample/Controllers/NorthwindController.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using DevExtreme.AspNet.Data;

using Sample.Models;
using System.Linq;
using System.Threading.Tasks;

using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
Expand Down
2 changes: 0 additions & 2 deletions net/Sample/DataSourceLoadOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using DevExtreme.AspNet.Data.Helpers;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System.Linq;
using System.Threading.Tasks;

namespace Sample {

Expand Down
4 changes: 0 additions & 4 deletions net/Sample/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Sample {

Expand Down
4 changes: 1 addition & 3 deletions net/Sample/Models/Category.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sample.Models {
Expand Down
4 changes: 1 addition & 3 deletions net/Sample/Models/Customer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sample.Models {
Expand Down
4 changes: 1 addition & 3 deletions net/Sample/Models/NorthwindContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore;

namespace Sample.Models {

Expand Down
4 changes: 1 addition & 3 deletions net/Sample/Models/Order.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sample.Models {
Expand Down
5 changes: 1 addition & 4 deletions net/Sample/Models/OrderDetail.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sample.Models {

Expand Down
4 changes: 1 addition & 3 deletions net/Sample/Models/Product.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sample.Models {
Expand Down
4 changes: 1 addition & 3 deletions net/Sample/Models/Shipper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Sample.Models {
Expand Down
35 changes: 20 additions & 15 deletions net/Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore;
using Sample.Models;

namespace Sample {
public class Program {
public static void Main(string[] args) {
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.ConfigureLogging(logging => logging.AddConsole())
.Build();
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddControllersWithViews()
.AddRazorRuntimeCompilation();
builder.Services
.AddLogging()
.AddEntityFrameworkSqlServer()
.AddDbContext<NorthwindContext>(options => options
//.UseSqlServer("Server=.\\SQLEXPRESS; Database=Northwind; Trusted_Connection=True")
.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB; Database=Northwind; Integrated Security=True; MultipleActiveResultSets=True; App=EntityFramework")
);

host.Run();
var app = builder.Build();
app.UseStaticFiles();
app.UseRouting();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();
}
}
}
4 changes: 3 additions & 1 deletion net/Sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\DevExtreme.AspNet.Data\DevExtreme.AspNet.Data.csproj" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.28" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.0.96" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Expand Down
34 changes: 0 additions & 34 deletions net/Sample/Startup.cs

This file was deleted.

6 changes: 3 additions & 3 deletions net/Sample/libman.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
"destination": "wwwroot/lib/"
},
{
"library": "node_modules/devextreme/dist/js/dx.all.debug.js",
"library": "node_modules/devextreme-dist/js/dx.all.debug.js",
"provider": "filesystem",
"destination": "wwwroot/lib/devextreme/js/"
},
{
"library": "node_modules/devextreme/dist/css/dx.light.css",
"library": "node_modules/devextreme-dist/css/dx.light.css",
"provider": "filesystem",
"destination": "wwwroot/lib/devextreme/css/"
},
{
"library": "node_modules/devextreme/dist/css/icons/",
"library": "node_modules/devextreme-dist/css/icons/",
"provider": "filesystem",
"destination": "wwwroot/lib/devextreme/css/icons"
},
Expand Down
Loading

0 comments on commit 87dd3d8

Please sign in to comment.