
本文共 3424 字,大约阅读时间需要 11 分钟。
���������AOP���
��������������� ��������������������������������������� =������������������������������ ���Aspect������������������AOP��������������������������������������������� =��� ������������
������������������
���Aspect��� ��� ������������ ��������������������������������������� ��������� ���Aspect��� ������2��������������������������������������������������������� ������������Aspect���
��������������������������� Transaction ������
���������������������������������������Transaction���������������������TransactionScope���
���������������������������������������������������������ORM������
���������������������
��������������� ������ ���������������������db ������������������ ��������� person ���insert���db��� ������������������������ ������school ���person ������������db ������������������
������������������������������������������������������������������������������������������������������������������������������������
������������������������������������������������ ���������������������������������������������������������AOP������������������������������
���������������������������������������
���������������
������������ ��������������������������������������������������� EnableTransactionScope ������ ��������������������������������������������������� ���������������������������
��������������������������� ������������������������
- ���������������������������������������������������������������������������(���������������������������������)
- ���������������DI���������������������������������������DI���������������������������������������
- ���������������������������������������������������������������������������������������
������������������������ Just Do It
1. ������ ������DI������ ������ ���
���2������������autofac���������������������������������������2������ ���������������������������������1���������2
���3���������������������������
����������������~~
������������������������������������������autofac������������������������������������ ������������������������������������
2. ������������ ������������AOP������������������
������������������������������
������������������������
3. ���������������������TransactionScope������
������������class������������PointcutAttribute ������������������ ������������������������������ ������������ new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)
��������������������������������������������������������������� [EnableTransactionScope] ������������
������
���������������������������������������������������������AOP���������������������������������������������(������������������������Arround���)
���������������������
- ������Componet������������������������autofac���������
- ������Aspect���������������������������autofac���������������������
- ���������������������������������(���������������������������PointCut������)������������������������
������������ | ������������ | ������ |
---|---|---|
������������ | ������AspectBeforeAttribute | ���������������������������������������������������������-������������������ |
������������ | ������AspectAfterAttribute | ���������������������������������(���������������)���������������-������������������������ |
������������ | ������AspectAroundAttribute | ������������������������������������������������������������-���������������-������������������������ |
PointCut������ | ������PointcutAttribute | ������������������������������������������������������������TransactionScope������������������������ |
���������������
发表评论
最新留言
关于作者
