Skip to content

Commit

Permalink
Service error fixed
Browse files Browse the repository at this point in the history
Selected Researcher binding bug isn't fixed though
  • Loading branch information
xtenzQ committed Mar 11, 2019
1 parent 981d3fb commit 02a7649
Show file tree
Hide file tree
Showing 16 changed files with 253 additions and 30 deletions.
1 change: 1 addition & 0 deletions ResearchersWPF.Data/Model/ResDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class ResDbContext : DbContext

public ResDbContext()
{
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_e_sqlite3());
Database.EnsureCreated();
}

Expand Down
2 changes: 1 addition & 1 deletion ResearchersWPF.Data/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<package id="Microsoft.EntityFrameworkCore.Design" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore.Relational" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore.Sqlite" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore.Sqlite.Core" version="2.2.2" targetFramework="net461" />
<!--<package id="Microsoft.EntityFrameworkCore.Sqlite.Core" version="2.2.2" targetFramework="net461" />-->
<package id="Microsoft.EntityFrameworkCore.Tools" version="2.2.2" targetFramework="net461" developmentDependency="true" />
<package id="Microsoft.Extensions.Caching.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Caching.Memory" version="2.2.0" targetFramework="net461" />
Expand Down
Binary file added ResearchersWPF.Service/App_Data/Researchers.db
Binary file not shown.
16 changes: 8 additions & 8 deletions ResearchersWPF.Service/DataContracts/Researcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ namespace ResearchersWPF.Service.DataContracts
public class Researcher
{
[DataMember]
public int ResearcherId { get; private set; }
public int ResearcherId { get; set; }

[DataMember]
public string LastName { get; private set; }
public string LastName { get; set; }

[DataMember]
public string FirstName { get; private set; }
public string FirstName { get; set; }

[DataMember]
public string MiddleName { get; private set; }
public string MiddleName { get; set; }

[DataMember]
public int DepartmentNumber { get; private set; }
public int DepartmentNumber { get; set; }

[DataMember]
public int Age { get; }
public int Age { get; set; }

[DataMember]
public string AcademicDegree { get; }
public string AcademicDegree { get; set; }

[DataMember]
public string Position { get; }
public string Position { get; set; }

internal Researcher(Business.Logic.Researcher researcher)
{
Expand Down
2 changes: 1 addition & 1 deletion ResearchersWPF.Service/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!--Чтобы избежать раскрытия метаданных, до развертывания задайте следующим параметрам значение "false". -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- Чтобы при сбое получать подробные сведения об исключении для целей отладки, установите для нижеприведенного параметра значение true. Перед развертыванием установите значение false, чтобы избежать раскрытия информации об исключении -->
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
Expand Down
76 changes: 71 additions & 5 deletions ResearchersWPF.UI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,80 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IArticleService" />
<binding name="BasicHttpBinding_IMonographService" />
<binding name="BasicHttpBinding_IPresentationService" />
<binding name="BasicHttpBinding_IReportService" />
<binding name="BasicHttpBinding_IResearcherService" />
<binding name="BasicHttpBinding_IArticleService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IMonographService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IPresentationService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IReportService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IResearcherService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
Expand Down
2 changes: 1 addition & 1 deletion ResearchersWPF.UI/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ResearchersWPF.UI"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
StartupUri="MainWindow.xaml">
>
<Application.Resources>
<Style TargetType="DataGridCell">
<Style.Triggers>
Expand Down
9 changes: 9 additions & 0 deletions ResearchersWPF.UI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,14 @@ namespace ResearchersWPF.UI
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

MainWindow window = new MainWindow();
window.Show();

BootStrapper.Initialize();
}
}
}
2 changes: 1 addition & 1 deletion ResearchersWPF.UI/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace ResearchersWPF.UI
{
public class Bootstrapper
public class BootStrapper
{
public static void Initialize()
{
Expand Down
9 changes: 8 additions & 1 deletion ResearchersWPF.UI/ResearchersWPF.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Bootstrapper.cs" />
<Compile Include="BootStrapper.cs" />
<Compile Include="Common\CommandBase.cs" />
<Compile Include="Common\ViewModelBase.cs" />
<Compile Include="Connected Services\svcArticle\Reference.cs">
Expand Down Expand Up @@ -293,6 +293,13 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Content Include="Web.config" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down
21 changes: 11 additions & 10 deletions ResearchersWPF.UI/View/ArticleListView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<ListView Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="Stretch" SelectionMode="Single" x:Name="lsvArticleList" ItemsSource="{Binding Articles}">
<ListView.View>
<GridView>
<GridViewColumn Header="Название статьи" DisplayMemberBinding="{Binding Name }"/>
<GridViewColumn Header="Название журнала" DisplayMemberBinding="{Binding MagazineName }"/>
<GridViewColumn Header="Дата издания" DisplayMemberBinding="{Binding ReleaseDate}"/>
<GridViewColumn CellTemplate="{StaticResource RowButtons}"/>
</GridView>
</ListView.View>
</ListView>
<ToolBarTray Grid.Column="0" Grid.Row="1" Background="White">
<ToolBar Height="25" VerticalAlignment="Top" Background="White">
<Button x:Name="btnAddArticle" Content="Добавить" Click="btnAddArticle_Click" >
Expand All @@ -47,5 +37,16 @@
</Button>
</ToolBar>
</ToolBarTray>
<ListView Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="Stretch" SelectionMode="Single" x:Name="lsvArticleList" ItemsSource="{Binding Articles}">
<ListView.View>
<GridView>
<GridViewColumn Header="Название статьи" DisplayMemberBinding="{Binding Name }"/>
<GridViewColumn Header="Название журнала" DisplayMemberBinding="{Binding MagazineName }"/>
<GridViewColumn Header="Дата издания" DisplayMemberBinding="{Binding ReleaseDate}"/>
<GridViewColumn CellTemplate="{StaticResource RowButtons}"/>
</GridView>
</ListView.View>
</ListView>

</Grid>
</UserControl>
2 changes: 1 addition & 1 deletion ResearchersWPF.UI/View/ReportListView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</ListView>
<ToolBarTray Grid.Column="0" Grid.Row="1" Background="White">
<ToolBar Height="25" VerticalAlignment="Top" Background="White">
<Button x:Name="btnAddReport" Content="Добавить" Click="btnAddReport_Click" >
<Button x:Name="btnAddReport" Content="Добавить" Click="btnAddReport_Click">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
Expand Down
2 changes: 1 addition & 1 deletion ResearchersWPF.UI/View/ResearcherListView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<ListView Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="Stretch" SelectionMode="Single" x:Name="lsvResearcherList" ItemsSource="{Binding ResearcherList}" SelectedItem="{Binding SelectedResearcher}">
<ListView Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="Stretch" x:Name="lsvResearcherList" ItemsSource="{Binding ResearcherList}" SelectedItem="{Binding SelectedResearcher}">
<ListView.View>
<GridView>
<GridViewColumn Header="Фамилия" DisplayMemberBinding="{Binding LastName }"/>
Expand Down
31 changes: 31 additions & 0 deletions ResearchersWPF.UI/Web.Debug.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- Дополнительные сведения об использовании преобразования web.config см. на странице https://go.microsoft.com/fwlink/?LinkId=125889. -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
В следующем примере преобразование "SetAttributes" будет изменять значение
"connectionString" с целью использования "ReleaseSQLServer", только когда
указатель "Match" находит атрибут "name", который имеет значение "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
В следующем пример преобразование "Replace" будет заменять весь
раздел <customErrors> в файле web.config.
Заметьте, поскольку имеется только один раздел customErrors в узле
<system.web>, не требуется использовать атрибут "xdt:Locator".
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
32 changes: 32 additions & 0 deletions ResearchersWPF.UI/Web.Release.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- Дополнительные сведения об использовании преобразования web.config см. на странице https://go.microsoft.com/fwlink/?LinkId=125889. -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
В следующем примере преобразование "SetAttributes" будет изменять значение
"connectionString" с целью использования "ReleaseSQLServer", только когда
указатель "Match" находит атрибут "name", который имеет значение "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
В следующем пример преобразование "Replace" будет заменять весь
раздел <customErrors> в файле web.config.
Заметьте, поскольку имеется только один раздел customErrors в узле
<system.web>, не требуется использовать атрибут "xdt:Locator".
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
Loading

0 comments on commit 02a7649

Please sign in to comment.