77 lines
2.1 KiB
Vue
77 lines
2.1 KiB
Vue
<template>
|
||
<section>
|
||
<p>在建立或修改了实体类之后,可以将实体类更新到数据库。</p>
|
||
<p>
|
||
在Visual Studio中选择
|
||
<a-breadcrumb separator=">">
|
||
<a-breadcrumb-item>工具</a-breadcrumb-item>
|
||
<a-breadcrumb-item>NuGet 包管理器</a-breadcrumb-item>
|
||
<a-breadcrumb-item>程序包管理控制台</a-breadcrumb-item>
|
||
</a-breadcrumb>之后在打开的程序包管理控制台中,默认项目选择
|
||
<a-tag class="mr-none" color="orange">Ewide.Database.Migrations</a-tag>,并在控制台中输入命令。
|
||
</p>
|
||
<h4>生成迁移文件</h4>
|
||
<Highlight :code="'add-migration init -c \'DefaultDbContext\''" language="c++" />
|
||
<p>其中</p>
|
||
<ul>
|
||
<li>
|
||
<p>
|
||
<a-tag color="blue">add-migration</a-tag>是固定的命令。
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p>
|
||
<a-tag color="blue">init</a-tag>是自定义的数据库版本号。
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p>
|
||
<a-tag color="blue">-c</a-tag>是固定的参数。
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p>
|
||
<a-tag color="blue">'DefaultDbContext'</a-tag>是对应的DbContext。
|
||
</p>
|
||
</li>
|
||
</ul>
|
||
<h4>更新迁移到数据库</h4>
|
||
<p>
|
||
在确保
|
||
<a-tag class="mr-none" color="orange">Ewide.Database.Migrations</a-tag>中已经生成迁移文件之后,可以运行更新命令。
|
||
</p>
|
||
<Highlight :code="'update-database -context \'DefaultDbContext\''" language="c++" />
|
||
<p>其中</p>
|
||
<ul>
|
||
<li>
|
||
<p>
|
||
<a-tag color="blue">update-database</a-tag>是固定的命令。
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p>
|
||
<a-tag color="blue">-context</a-tag>是固定的参数。
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p>
|
||
<a-tag color="blue">'DefaultDbContext'</a-tag>是对应的DbContext。
|
||
</p>
|
||
</li>
|
||
</ul>
|
||
</section>
|
||
</template>
|
||
<script>
|
||
import Highlight from '../highlight';
|
||
|
||
export default {
|
||
components: {
|
||
Highlight,
|
||
},
|
||
props: {
|
||
codes: {
|
||
type: Object,
|
||
},
|
||
},
|
||
};
|
||
</script> |