Created
March 14, 2014 18:14
-
-
Save fabriciosanchez/9553523 to your computer and use it in GitHub Desktop.
Repository_General
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Repository_General: IRepositorioGeneral, IDisposable | |
{ | |
... | |
public SeuModeloDeDados db = new SeuModeloDeDados(); | |
private bool disposed = false; | |
public void Dispose() | |
{ | |
Dispose(true); | |
GC.SuppressFinalize(this); | |
} | |
~Repository_General() | |
{ | |
Dispose(false); | |
} | |
protected virtual void Dispose(bool disposing) | |
{ | |
if (!this.disposed) | |
{ | |
if (disposing) | |
{ | |
if (this.db != null) | |
{ | |
this.db.Dispose(); | |
this.db = null; | |
} | |
} | |
} | |
} | |
public List<VideosRetornados> RetornaQuatroVideosMaisRecentes() | |
{ | |
try | |
{ | |
var RetornoVideo = (from v in db.SeusVideos | |
orderby v.IDVideo descending | |
select new VideosRetornados | |
{ | |
_Titulo = v.TituloVideo, | |
_CaminhoImagem = v.CaminhoBreadcrumbVideo, | |
_LinkExterno = v.LinkExternoParaOVideo | |
}).Take(4).ToList(); | |
return RetornoVideo; | |
} | |
catch (EntitySqlException ex) | |
{ | |
throw new Exception(ex.Message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment