This file contains hidden or 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 System; | |
using System.Threading; | |
static class Program { | |
static void Main() { | |
Console.Write("Performing some task... "); | |
using (var progress = new ProgressBar()) { | |
for (int i = 0; i <= 100; i++) { | |
progress.Report((double) i / 100); |
This file contains hidden or 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
{ | |
"connectionString": "...", | |
"projectPath": "...", | |
"baseNamespace": "...", | |
"ProjectFile": "...", | |
"enums": [ | |
{ | |
"table": "", | |
"valueColumn": "", | |
"nameColumn": "", |
This file contains hidden or 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
{ | |
"table": "OrderType", | |
"valueColumn": "ID", | |
"nameColumn": "Name", | |
"type": "int" | |
} |
This file contains hidden or 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 sealed class OrderTypeEnum | |
{ | |
private readonly int _value; | |
private OrderTypeEnum(int value) | |
{ | |
_value = value; | |
} | |
public static implicit operator int(OrderTypeEnum @enum) | |
{ |
This file contains hidden or 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
// An example using Ninject | |
using Example.DataAccess.Infrastructure; | |
using Example.DataAccess.Infrastructure.Interfaces; | |
using Ninject.Modules; | |
namespace Example.Business.Base.Concrete.Modules | |
{ | |
internal class DataAccessModule : NinjectModule | |
{ | |
public override void Load() |
This file contains hidden or 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
var unit = Context.Unit() | |
var userRepository = unit.UserRepository; // getting the repository | |
var users = userRepository.Get().Where.GivenName.Contains("John").Filter().Query().ToList(); // Getting objects | |
if (users.Count < 1) | |
return null; | |
var user = users.First(); | |
user.GivenName = "Doe"; // Updating the object .will update when committing changes | |
userRepository.Update(user); | |
var rusith = userRepository.Get().Where.GivenName.Contains("Rusith").Filter().Top(1).Query().FirstOrDefault(); // Getting an object | |
userRepository.Remove(rusith); // deleting an object |
This file contains hidden or 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
// Executing a procedure | |
unit.Procedures.SPC_GetOrders<OrderDetailModel>_List(100); |
This file contains hidden or 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
// List | |
unit.Procedures.SPC_GetOrders_List<OrderDetailModel>(); | |
// Single | |
int deleted = unit.Procedures.SPC_DeleteOrder_Single<bool>(100); | |
// Void | |
unit.Procedures.SPC_DeleteOrder_Void(100); |
This file contains hidden or 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
... | |
var repo = unit.InvoicesViewRepository; | |
var filter = repo.Get(); | |
if (!string.IsNullOrWhiteSpace(search)) | |
{ | |
filter. | |
Where.ShipTo.Contains(search). | |
Or.FactoryInvoiceNo.Contains(search) | |
.Or.No.Contains(search).Filter(); |
This file contains hidden or 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
... | |
var repo = unit.InvoicesViewRepository; | |
var filter = repo.Get() | |
.OrderBy.ModifiedDate.Ascending().Order(); | |
... |
OlderNewer