Dodano seedy bazy danych
This commit is contained in:
parent
720404697a
commit
aecacd4dac
@ -13,7 +13,7 @@ namespace Forum.DataAccessLayer
|
||||
{
|
||||
public ApplicationDbContext()
|
||||
: base("DefaultConnection", throwIfV1Schema: false)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
public static ApplicationDbContext Create()
|
||||
|
@ -94,6 +94,10 @@
|
||||
<Compile Include="Migrations\201812012216378_Added Title.Designer.cs">
|
||||
<DependentUpon>201812012216378_Added Title.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201812012312365_Seedtry.cs" />
|
||||
<Compile Include="Migrations\201812012312365_Seedtry.Designer.cs">
|
||||
<DependentUpon>201812012312365_Seedtry.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\MailService.cs" />
|
||||
@ -125,6 +129,9 @@
|
||||
<EmbeddedResource Include="Migrations\201812012216378_Added Title.resx">
|
||||
<DependentUpon>201812012216378_Added Title.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201812012312365_Seedtry.resx">
|
||||
<DependentUpon>201812012312365_Seedtry.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Repostories\" />
|
||||
|
29
Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012312365_Seedtry.Designer.cs
generated
Normal file
29
Trunk/Server/Forum/Forum.DataAccessLayer/Migrations/201812012312365_Seedtry.Designer.cs
generated
Normal file
@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace Forum.DataAccessLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
|
||||
public sealed partial class Seedtry : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(Seedtry));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201812012312365_Seedtry"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
namespace Forum.DataAccessLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class Seedtry : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Target" xml:space="preserve">
|
||||
<value>H4sIAAAAAAAEAO1d227kuBF9D5B/EPSUBN5uXzKDidG9C2/b3hgZXzLtWeTNoCW6LYwuvRI1YyPYL8tDPim/EFJXXiVSUqvlTTAvbZE8LBariqwiWfOff/178cNL4FtfYZx4Ubi0j2aHtgVDJ3K9cLO0U/T03Qf7h+9//7vFhRu8WD+X9U5IPdwyTJb2M0Lb0/k8cZ5hAJJZ4DlxlERPaOZEwRy40fz48PAv86OjOcQQNsayrMWnNEReALM/8J+rKHTgFqXAv45c6CfFd1yyzlCtGxDAZAscuLQvozgNZucAgTPHgUnyEbzC2LbOfA9gYtbQf7ItEIYRAgiTevo5gWsUR+FmvcUfgH//uoW43hPwE1gM4bSurjuaw2MymnndsIRy0gRFgSHg0UnBnjnfvBOT7Yp9mIEXmNHolYw6Y+LSPguTb4RhfFenKz8m1RQcnuUzM8ubH1hNlQ4qQcHyRP4dWKvUR2kMlyFMUQz8A+suffQ952/w9T76AsNlmPo+TTemHJcxH/Cnuzjawhi9foJPxWiuXNuas+3mfMOqGdUmH+lViE6ObesGdw4efViJBcWVNYpi+BMMYQwQdO8AQjAOCQbMGCv0zvWFGQTL3sjveyz1kg6bQbB6INxdiYPlGWunbV2Dl48w3KDnpY1/2tal9wLd8ksB/Dn0sDLjRihOW/u58Zwvw3dyA756m4yZXHf4zycsObgA+Lb1CfpZpeTZ2+Z6XMjaA1vvMo6CT5FfSTJT/LCO0tghHI/Ude5BvIFIn86/pzDJlVFCY1n4kPeU0ATyZVXPJXVChZJ8mrTFvNbhRs2mB4nNXncd54F+I9ouEemj4w9aIm2osJe4Ovm1c429CIDnN/Ry/O79UL1gI/TkxQGs2PljhGUYhMbMuQNJ8i2K3b+C5HnnDFpDJ42xmqwRCLY77+3uOQrhTRo8EuUbr6/Bpub+W3QJHLziXYSkVW+8j5HzJUrRReiSte8zcsSlUB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k0v65ZUF2V6OIpGG2TZEh8G4K1zGpLz+fyvc5h4mxqCPGcJocNsmqs6V+FTVO7dOYrKKtxp4DVEwCVvT2LkPQEH4WJyXTH7/1SyK2Dk0uwjdK/C2xRtU4SHDINHn5El4gM09Z+lEmNpXtxuM1EeYgiYTI9cabgNf0w9363ovpScOyogiHNRnEiTuUTkZHrzWiHdRKEmUMG+yie6h8HWx2DJbbgGX2EX2rD4fYQb4LzW98VUIO0TwbJ9ce6BTQyCpMCo2+M/sQy7wcv3/wVowLfeJYcAAA==</value>
|
||||
</data>
|
||||
<data name="DefaultSchema" xml:space="preserve">
|
||||
<value>dbo</value>
|
||||
</data>
|
||||
</root>
|
@ -1,3 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Forum.DataAccessLayer.Models;
|
||||
|
||||
namespace Forum.DataAccessLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
@ -14,10 +17,28 @@ namespace Forum.DataAccessLayer.Migrations
|
||||
|
||||
protected override void Seed(Forum.DataAccessLayer.ApplicationDbContext context)
|
||||
{
|
||||
// This method will be called after migrating to the latest version.
|
||||
if (!context.Categories.Any(c=>c.CategoryName=="Zwroty"))
|
||||
{
|
||||
var zwroty = new Category()
|
||||
{
|
||||
CategoryName = "Zwroty",
|
||||
Questions = new List<Question>()
|
||||
{
|
||||
new Question()
|
||||
{
|
||||
Title = "Jak dokonaæ zwrotu",
|
||||
Content = "Chce dostaæ zwrot nwm co robic pls admian halp!11",
|
||||
IsClosed = false,
|
||||
PostDate = DateTime.Now,
|
||||
Nick = "Potrzebuj¹cy"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// You can use the DbSet<T>.AddOrUpdate() helper extension method
|
||||
// to avoid creating duplicate seed data.
|
||||
context.Categories.Add(zwroty);
|
||||
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,3 +5,12 @@
|
||||
}
|
||||
|
||||
<h2>@Model.CategoryName</h2>
|
||||
|
||||
<ul>
|
||||
@{
|
||||
foreach (var question in Model.Questions)
|
||||
{
|
||||
<li>@Html.ActionLink(question.Title,"Question","Home",new{id=question.Id},null)</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user