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
using EspacioDeNombres; | |
namespace EspacioDeNombreActual | |
{ | |
public class Clase | |
{ | |
//Constructor.. | |
//Sobrecargas | |
//Propiedades.. |
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
namespace UsingTest | |
{ | |
public class DateTime | |
{ | |
public static string Now = "No me importa que día es hoy"; | |
} | |
} |
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
namespace UsingTest.Test | |
{ | |
using System; | |
using UsingTest; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(DateTime.Now); |
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
.method private hidebysig static void Main(string[] args) cil managed | |
{ | |
.entrypoint | |
// Code size 24 (0x18) | |
.maxstack 8 | |
IL_0000: nop | |
IL_0001: call valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::get_Now() | |
IL_0006: box [mscorlib]System.DateTime | |
IL_000b: call void [mscorlib]System.Console::WriteLine(object) | |
IL_0010: nop |
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 interface IRepository<T> | |
{ | |
/// <summary> | |
/// Busca una entidad por su ID | |
/// </summary> | |
/// <param name="id">Identificador del registro</param> | |
/// <returns>Ojeto de resultado de búsqueda</returns> | |
/// <remarks>Este método está acotado para que el id sea entero. | |
/// Si se requiere dinamismo en el tipado, se debe agregar otro genérico.</remarks> | |
T FindById(int id); |
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 interface IEntityRepository : IRepository<Entity> | |
{ | |
/// <summary> | |
/// Buscar registro por la propiedad foo | |
/// </summary> | |
/// <param name="foo">valor de propiedada buscar</param> | |
/// <returns>Entity</returns> | |
Entity FindByFoo(string foo); | |
} |
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<T> : IRepository<T> | |
{ | |
//Implementaciones de IRepository utilizando T | |
} |
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 Entity : Repository<Entity>, IEntityRepository | |
{ | |
//Propiedades | |
//Constructor con nueva instancia del contexto | |
//Implementación de métodos | |
//Métodos particulares de clase | |
//Huevos de pascua | |
} |
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 EntityRepository | |
{ | |
private Repository<Entity> repository; | |
public IEnumerable<Entity> FindEntityByName(string name) | |
{ | |
return repository.FindBy(e => e.Name == name); | |
} | |
} |
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
namespace UsingTest.Test | |
{ | |
using System; //Declaración | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.Write("Console output: "); | |
Console.WriteLine(DateTime.Now); |
OlderNewer