document/代码块/C#/bigdatacache.snippet
2024-06-30 04:47:39 +08:00

60 lines
1.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>bigdatacache</Title>
<Shortcut>bigdatacache</Shortcut>
<Description>类的代码片段包含数据库访问</Description>
<Author>zz</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>name</ID>
<ToolTip>字段名</ToolTip>
<Default>T_APP_CONFIGS</Default>
</Literal>
<Literal>
<ID>daoclass</ID>
<ToolTip>类名</ToolTip>
<Default>T_App_Config</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[
/// <summary>
/// 缓存数据
/// </summary>
private static List<$daoclass$> _$name$ = null;
/// <summary>
/// 锁
/// </summary>
private static object _$name$_LOCK = new object();
/// <summary>
/// app配置数据引用类型不可修改只能查询使用
/// </summary>
public static List<$daoclass$> $name$LIST
{
get
{
if (_$name$ == null)
{
lock (_$name$_LOCK)
{
var dao = new DAO();
_$name$ = dao.daoRes.context.$daoclass$.ToList();
}
}
return _$name$;
}
}
$selected$$end$
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>