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
| [WorkflowDescription("1.0")] | |
| public class ExpenseWorkflow : Workflow | |
| { | |
| public ExpenseWorkflow() | |
| { | |
| ScheduleChildWorkflow<ApproveExpense>() | |
| .OnCompletion(e=>e.WaitForAnySignal("Accepted", "Rejected")); | |
| ScheduleLambda("SubmitToAccount").AfterLambda("ApproveExpense") | |
| .When(_=>Signal("Accepted").IsTriggered()); |
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
| [WorkflowDescription("1.0")] | |
| public class ExpenseWorkflow : Workflow | |
| { | |
| public ExpenseWorkflow() | |
| { | |
| ScheduleLambda("ApproveExpense") | |
| .OnCompletion(e=>e.WaitForAnySignal("Accepted", "Rejected")) | |
| .WithInput(_=>new{Id}); //Send workflow id to lambda functions to send signals to this workflow. | |
| ScheduleLambda("SubmitToAccount").AfterLambda("ApproveExpense") |
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
| //IDataContext.cs | |
| public interface IDataContext | |
| { | |
| DbSet<T> Collection<T>() where T : class; | |
| void SaveChanges(); | |
| } | |
| //DataContext.cs | |
| public class DataContext : IDataContext | |
| { | |
| private readonly DbContext _dbContext; |
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 class GenericRepository : IRepository | |
| { | |
| private readonly IDataContext _dataContext; | |
| public GenericRepository(IDataContext dataContext) | |
| { | |
| _dataContext = dataContext; | |
| } | |
| public void Attach<T>(T entity) where T : class | |
| { | |
| _dataContext.Collection<T>().Attach(entity); |
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 interface IRepository | |
| { | |
| void Attach<T>(T entity) where T : class; | |
| void Add<T>(T entity) where T : class; | |
| void Delete<T>(T entity) where T : class; | |
| T FindByKey<T>(object key) where T : class; | |
| IQueryable<T> GetAll<T>() where T : class; | |
| void Save(); | |
| } |
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
| //interface to read meetings from file | |
| internal interface IMeetingFileParser | |
| { | |
| IEnumerable<Meeting> ParseMeetings(string filePath); | |
| } | |
| internal class CsvMeetingFileParser : IMeetingFileParser | |
| { | |
| private readonly IFileReader _fileReader; | |
| public CsvMeetingFileParser(IFileReader fileReader) | |
| { |
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 static MeetingFile Csv(string path) | |
| { | |
| var meetingLines = File.ReadAllLines(path).Skip(1).Select(line => new MeetingLine(line)); | |
| return new MeetingFile(meetingLines.Select(ml=>ml.Meeting).ToArray()); | |
| } |
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 class CsvMeetingFile | |
| { | |
| private readonly string _filePath; | |
| public CsvMeetingFile(string filePath) | |
| { | |
| _filePath = filePath; | |
| } | |
| public IEnumerable<Meeting> Meetings() | |
| { | |
| var meetingLines = File.ReadAllLines(_filePath).Skip(1).Select(line => new MeetingLine(line)); |
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 class GenericRepository : IRepository | |
| { | |
| private readonly IDataContext _dataContext; | |
| public GenericRepository(IDataContext dataContext) | |
| { | |
| _dataContext = dataContext; | |
| } | |
| public void Attach<T>(T entity) where T : class | |
| { | |
| _dataContext.Collection<T>().Attach(entity); |
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 interface IRepository | |
| { | |
| void Attach<T>(T entity) where T : class; | |
| void Add<T>(T entity) where T : class; | |
| void Delete<T>(T entity) where T : class; | |
| T FindByKey<T>(object key) where T : class; |
NewerOlder