学习过程,简单记录,不求详尽,看懂就行,格式随意,高效学习

1. 实体类继承了IModel空接口时,services.RegisterSailMvc(......)初始化时,自动生成该实体类相应的数据表

【7.26】同样字段上面加[HColumn]特性,才会在数据库中生成想应的字段!!!!!!!!!!!

 

2. 数据注解:[ModelData("prop","Id")]

 

注解作用:项目合同表要找对应的客户公司通过客户公司表的Id来找

 

3. 入口文件注入的方式引入模板文件

services.AddScoped<AdminLayout>();

@inject Layout _

 

4. 登录页面引入一个不存在的文件,可以解决隐藏div在刷新页面时闪现的问题:

 

5.关于密码加密后转换为string类型的自定义方法使用:Encrypt()

- 不可以使用ToString()

- toMd5()也是自定义方法!

延申:原MD5加密后,返回值类型是byte[]

具体用法:

static void Main(string[] args)
{
    MD5 md5 = MD5.Create();
    var mi = md5.ComputeHash(Encoding.Unicode.GetBytes("123456")).ToString();

    Console.WriteLine(mi);
}

 6. 首页获取登录用户名的两种方式:

@using Qvolax.Models
@using Sail.Web

<span class="username">@(Model.User?.UserName)</span>
<span class="username">@WebHelper.CurrentAdmin.UserName</span>

 7. 模版类型

@*页面显示模版:listTmpl*@
<tmpl id="listTmpl">
.......
</Tmpl>

@*新增页面模版:modalTmpl*@
<tmpl id="modalTmpl">
............
</tmpl>

@*详情页面模版:ViewTmpl*@
<tmpl id="viewTmpl">
.............
</tmpl>

 8. 日历插件使用;

<script src="~/Scripts/datepicker/WdatePicker.js"></script>


<input class="date" Element="@(_.Create(x => x.Birthday))" />

//如上,元素中加class属性date即可默认使用它了

html自带日期插件使用:

<input type="date" />

 9. 表单的约束:

<input class="validate[required,custom[decimal]]" Element="@(_.Create(x => x.CompanyPart))" />

class约束:必填、必须的decimal类型

 

10. 项目运行时如何查看实时执行的SQL语句!

- NuGet包:huanent.logging.file

- 在项目目录下建立配置文件appsettings.config,设置如下:

{
  "IsEnableSqlLog": true
}

- 在Param.cs文件中:

CreateWebHostBuilder(args)
        .ConfigureLogging(builder => builder.AddFile())//配置:huanent.logging.file,生成sql log
        .Build().Run();

- 运行项目,在bin/.../.../...中会出现一个logs,里面.txt文件中记录的就是全部执行中的sql语句!

 

11. 

 

转载于:https://www.cnblogs.com/stickcsharp/p/11188113.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值