Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CS/.idea/.idea.InstantFeedback/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions CS/.idea/.idea.InstantFeedback/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions CS/.idea/.idea.InstantFeedback/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions CS/.idea/.idea.InstantFeedback/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CS/InstantFeedback.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Blazor" Version="25.1.3" />
<PackageReference Include="DevExpress.Blazor" Version="26.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
Expand Down
31 changes: 20 additions & 11 deletions CS/Pages/Grid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@
@using InstantFeedback.Models;

<DxGrid Data="Issues" ShowSearchBox=true
PageSize="50"
FilterMenuButtonDisplayMode="GridFilterMenuButtonDisplayMode.Always"
ShowGroupPanel=true
EditMode="GridEditMode.EditRow"
ShowFilterRow="true"
VirtualScrollingEnabled="true"
CssClass="h-100"
TextWrapEnabled=true
KeyFieldName="Id">
<Columns>
<DxGridDataColumn FieldName="Id" Width="100" />
<DxGridDataColumn FieldName="Subject" />
<DxGridDataColumn FieldName="UserId" Caption="User" Width="250">
<EditSettings>
<DxComboBoxSettings Data="Users" ValueFieldName="Id" TextFieldName="FullName" />
</EditSettings>
<DxGridCommandColumn Width="90"/>
<DxGridDataColumn FieldName="Id" Width="100" DataRowEditorVisible="false"/>
<DxGridDataColumn FieldName="Subject"/>
<DxGridDataColumn FieldName="User.FullName" Caption="User" Width="250">
<CellEditTemplate>
@{
var issue = (ServerMode.IssueWithUser)context.EditModel;
}
<DxComboBox TValue="ServerMode.UserInfo" TData="ServerMode.UserInfo" Data="Users" Value="issue.User" KeyFieldName="@nameof(ServerMode.UserInfo.Id)"
ValidationEnabled="false"
SelectedDataItemChanged="s => issue.User = s.DataItem" TextFieldName="@nameof(ServerMode.UserInfo.FullName)"
ListRenderMode="ListRenderMode.Virtual"/>
</CellEditTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="Created" Width="100" />
<DxGridDataColumn FieldName="Votes" Width="150" />
<DxGridDataColumn FieldName="Priority" Width="150" />
<DxGridDataColumn FieldName="Created" Width="100"/>
<DxGridDataColumn FieldName="Votes" Width="150"/>
<DxGridDataColumn FieldName="Priority" Width="150"/>
</Columns>
<GroupSummary>
<DxGridSummaryItem FieldName="Id" SummaryType="GridSummaryItemType.Count" />
Expand All @@ -30,5 +39,5 @@
public object Issues { get; set; }

[Parameter]
public IEnumerable<User> Users { get; set; }
public IEnumerable<ServerMode.UserInfo> Users { get; set; }
}
17 changes: 0 additions & 17 deletions CS/Pages/LocalData.razor

This file was deleted.

42 changes: 32 additions & 10 deletions CS/Pages/ServerMode.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,43 @@
<Grid Issues="instantFeedbackSource" Users="users" />

@code {
EntityInstantFeedbackSource instantFeedbackSource { get; set; }
IEnumerable<User> users;
GridDevExtremeDataSource<IssueWithUser> instantFeedbackSource { get; set; }
IEnumerable<UserInfo> users;

protected override void OnInitialized()
{
instantFeedbackSource = new EntityInstantFeedbackSource(e =>
{
e.KeyExpression = "Id";
e.QueryableSource = Context.Issues;
protected override void OnInitialized() {
var userQuery = Context.Issues.Include("User").Select(i => new IssueWithUser {
Id = i.Id,
Subject = i.Subject,
User = new UserInfo {
Id = i.UserId,
FullName = i.User.FirstName + " " + i.User.LastName,
},
Created = i.Created,
Votes = i.Votes,
Priority = i.Priority,
});
instantFeedbackSource = new GridDevExtremeDataSource<IssueWithUser>(userQuery);
users = Context.Users.Select(u => new UserInfo {
Id = u.Id,
FullName = u.FullName
});
users = Context.Users.ToList();
}

public void Dispose()
{
instantFeedbackSource?.Dispose();
}
public class IssueWithUser {
public int Id { get; set; }
public string Subject { get; set; }
public UserInfo User { get; set; }
public DateTime Created { get; set; }
public int Votes { get; set; }
public Priority Priority { get; set; }
}
public class UserInfo {
public int Id { get; set; }
public string FullName { get; set; }
}

}

14 changes: 7 additions & 7 deletions CS/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
options.SizeMode = DevExpress.Blazor.SizeMode.Medium;
});

//builder.Services.AddDbContext<IssuesContext>((sp, options) =>
//{
// var env = sp.GetRequiredService<IWebHostEnvironment>();
// var dbPath = Path.Combine(env.ContentRootPath, "Issues.mdf");
// options.UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Integrated Security=true;AttachDbFileName=" + dbPath);
//}, contextLifetime: ServiceLifetime.Transient);
builder.Services.AddDbContext<IssuesContext>((sp, options) => options.UseInMemoryDatabase("Issues"), contextLifetime: ServiceLifetime.Transient);
builder.Services.AddDbContext<IssuesContext>((sp, options) =>
{
var env = sp.GetRequiredService<IWebHostEnvironment>();
var dbPath = Path.Combine(env.ContentRootPath, "Issues.mdf");
options.UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Integrated Security=true;AttachDbFileName=" + dbPath);
}, contextLifetime: ServiceLifetime.Transient);
// builder.Services.AddDbContext<IssuesContext>((sp, options) => options.UseInMemoryDatabase("Issues"), contextLifetime: ServiceLifetime.Transient);
builder.Services.AddTransient<IssuesContextInitializer>();


Expand Down
4 changes: 3 additions & 1 deletion CS/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore.Database.Command": "Information",
"Microsoft.EntityFrameworkCore": "Information"
}
}
}