ABP学习笔记

1. Application层使用WebAPI调用时,调用类型方法:
.Get: Used if the method name starts with 'Get'.
•Put: Used if the method name starts with 'Put' or 'Update'.
•Delete: Used if the method name starts with 'Delete' or 'Remove'.
•Post: Used if the method name starts with 'Post', 'Create' or 'Insert'.
•Patch: Used if the method name starts with 'Patch'.
•Otherwise, Post is used by default as an HTTP verb.
2. 使用日志
Logger.Info("123");
3. 多租户
CompanyName.Core\SDZGConsts.cs--MultiTenancyEnabled
4. 语言设置
中文:CompanyName.Core\Localization\SourceFiles\SDZG-zh-CN.xml
5. 左侧导航菜单
CompanyName.Web.Mvc\Startup\SDZGNavigationProvider.cs
6. 使用权限
6.1
if(currentUserId==2){
PermissionChecker.Authorize(PermissionNames.Pages_Persons_Delete);
}
或者
6.2
if (!PermissionChecker.IsGranted(PermissionNames.Pages_Persons_Delete))
{
throw new AbpAuthorizationException("You are not authorized to create user!");
}
7. 属性更改记录
在Entity类中添加[Audited]特性
8. 抛出异常
throw new UserFriendlyException("You are not authorized to create user!")
9. js中通知及提示
通知会显示在右下角,稍后自动消失
abp.notify.success('a message text', 'optional title');
abp.notify.info('a message text', 'optional title');
abp.notify.warn('a message text', 'optional title');
abp.notify.error('a message text', 'optional title');
消息--弹框
abp.message.info('some info message', 'some optional title');
abp.message.success('some success message', 'some optional title');
abp.message.warn('some warning message', 'some optional title');
abp.message.error('some error message', 'some optional title');
abp.message.confirm(
'User admin will be deleted.', //确认提示
'Are you sure?',//确认提示(可选参数)
function (isConfirmed) {
if (isConfirmed) {
//...delete user 点击确认后执行
}
}
);
阻止点击页面
abp.ui.block(); //覆盖整个页面
abp.ui.block($('#MyDivElement')); //覆盖指定元素,可以把jquery对象作为参数
abp.ui.block('#MyDivElement'); //或者直接使用选择器参数
abp.ui.unblock(); //整个页面解除覆盖
abp.ui.unblock('#MyDivElement'); //指定元素解除覆盖
abp.ui.setBusy('#MyLoginForm');//繁忙
abp.ui.clearBusy('#MyLoginForm');//清除繁忙
格式化字符串(abp.utils.formatString)
var str = abp.utils.formatString('Hello {0}!', 'World'); //str = 'Hello World!'
var str = abp.utils.formatString('{0} number is {1}.', 'Secret', 42); //str = 'Secret number is 42'


猜你喜欢

转载自www.cnblogs.com/jerry-2000/p/9751964.html
ABP
今日推荐