本文整理汇总了C#中Entities.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.Dispose方法的具体用法?C# Entities.Dispose怎么用?C# Entities.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button1_Click
private void button1_Click(object sender, EventArgs e)
{
/*
ProcesosCBLL p = new ProcesosCBLL();
classFiltro f = new classFiltro();
f.DEP_PSOL = "06";
//f.COD_SOL = "2011-SGR-0001";
f.ID_ABOG_ENC = "22667823";
f.TIPO_FECHA = classFiltro.TipoFecha.REVISADO;
f.FECHA_I = Convert.ToDateTime("01/04/2011");
f.FECHA_F = Convert.ToDateTime("21/04/2011");
dataGridView1.DataSource=p.Consultar(f);
dataGridView1.Refresh();*/
Entities ctx = new Entities();
string cod = ctx.Database.SqlQuery<string>("Select to_char(sysdate) from vtiposcont ").FirstOrDefault<string>();
ctx.Dispose();
MessageBox.Show(cod);
}
示例2: LnVideo
/// <summary>
/// 获取单个视频
/// </summary>
/// <param name="ClassID"></param>
/// <param name="Width"></param>
/// <param name="Height"></param>
/// <returns></returns>
public static string LnVideo(string ClassID, string Width, string Height)
{
string result = "";
string vpath="";
int _cLassid = Convert.ToInt32(ClassID);
Entities mydb = new Entities();
L_Newss ln = mydb.L_Newss.Where(p=>p.ClassId==_cLassid).OrderByDescending(p=>p.NID).First();
string biaoda = @"value=""([\s\S]*?.wmv)""";
Regex regimg = new Regex(biaoda);
MatchCollection mcimg = regimg.Matches(ln.Content.ToString());
if (mcimg.Count > 0)
{
//AllPic += mcimg[0].ToString().Replace("src=", "").Replace("\"", "") + "|";
vpath=mcimg[0].ToString().Replace("value=", "").Replace("\"", "");
}
result = string.Format("<object style='width:{0}px; height: {1}px' codebase='http://activex.microsoft.com/activex/ controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902' type='application/x-oleobject' height='{1}' standby='Loading Microsoft Windows Media Player components...' width='{0}' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'><param name='FileName' value='{2}' /><param name='autoStart' value='1' /><param name='showControls' value='1' /><param name='showstatusbar' value='0' /><param name='windowlessvideo' value='false' /><embed name='MediaPlayer1' src='{2}' autostart='1' showcontrols='1' showstatusbar='0' windowlessvideo='false' width='{0}' height='{1}' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer' ></embed> </object>",Width,Height,vpath);
mydb.Dispose();
return result;
}
示例3: LnFlash
/// <summary>
/// 获取flash
/// </summary>
/// <param name="ClassID">栏目id,如为整站,则使用"N"</param>
/// <param name="Num">条数</param>
/// <param name="WordsNum">字数</param>
/// <param name="Width">宽度</param>
/// <param name="Height">高度</param>
/// <returns></returns>
public static string LnFlash(string ClassID, string Num, string WordsNum, string Width, string Height)
{
string result = "";
string AllText = "";
string AllPic = "";
string AllLink = "";
int _classID = Convert.ToInt32(ClassID);
int _num = Convert.ToInt32(Num);
Entities mydb = new Entities();
var q = from p in mydb.L_Newss
where p.Content.Contains("src=")
select p;
if (ClassID != "N")
{
q = q.Where(p => p.ClassId ==_classID).OrderByDescending(p => p.NID).Take(_num);
}
else
{
q = q.Take(_num).OrderByDescending(p => p.NID);
}
foreach (var p in q)
{
AllLink += "Pages_" + p.ClassId + "_" + p.NID + ".aspx|";
AllText += TrimString(p.Title, WordsNum) + "|";
string biaoda = @"src=""([\s\S]*?)""";
Regex regimg = new Regex(biaoda);
MatchCollection mcimg = regimg.Matches(p.Content.ToString());
if (mcimg.Count > 0)
{
AllPic += mcimg[0].ToString().Replace("src=", "").Replace("\"", "") + "|";
}
else
{
AllPic += "|";
}
}
result = string.Format("<script type=\"text/javascript\">var Flash_Width = {0};var Flash_Height = {1};var Txt_Height = 30;var Swf_Height = parseInt(Flash_Height + Txt_Height);var Pics_ = \'{2}\';var Links_ = \'{3}\';var Texts_ = \'{4}\';document.write(\'<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"\' + Flash_Width + \'\" height=\"\' + Swf_Height + \'\">\');document.write(\'<param name=\"allowScriptAccess\" value=\"sameDomain\"><param name=\"movie\" value=\"Flash.swf\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#ffffff\">\');document.write(\'<param name=\"menu\" value=\"false\"><param name=\"wmode\" value=\"opaque\">\');document.write(\'<param name=\"FlashVars\" value=\"pics=\' + Pics_ + \'&links=\' + Links_ + \'&texts=\' + Texts_ + \'&borderwidth=\' + Flash_Width + \'&borderheight=\' + Flash_Height + \'&textheight=\' + Txt_Height + \'\">\');document.write(\'<embed src=\"Flash.swf\" wmode=\"opaque\" FlashVars=\"pics=\' + Pics_ + \'&links=\' + Links_ + \'&texts=\' + Texts_ + \'&borderwidth=\' + Flash_Width + \'&borderheight=\' + Flash_Height + \'&textheight=\' + Txt_Height + \'\" menu=\"false\" bgcolor=\"#ffffff\" quality=\"high\" width=\"\' + Flash_Width + \'\" height=\"\' + Swf_Height + \'\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\');document.write(\'</object>\');</script>", Width, Height, AllPic.Remove(AllPic.Length - 1), AllLink.Remove(AllLink.Length - 1), AllText.Remove(AllText.Length - 1));
mydb.Dispose();
return result;
}
示例4: GetActa
public List<vDocActasParcial> GetActa(){
ctx = new Entities();
ObtenerDocumento();
ctx.Dispose();
return lep;
}