This repository has been archived by the owner on Mar 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Training Secretaries
scottmuc edited this page Sep 13, 2010
·
4 revisions
Secretaries by default do not have any training. This means that they will not be able to locate your files. In order to train a secretary you must enroll them in a school.
school.Enroll().SpecializingIn(FileType.File).For<TestEntity>();
That code will enroll the secretary so that it can return basic file references rooted at the path of the school and using a TestEntity folder specialization given to the school.
Once you’ve enrolled all the secretaries you need for a particular School (remember, school means root path), then you can retrieve a list of them through the graduation ceremony.
var trainedSecretaries = new GraduationCeremony(school.Enrollments).GetGraduates();
You don’t have to enroll Secretaries in Schools if you don’t want to. All the properties that a Secretary uses to construct paths are public so you can new up a Secretary and assign them all manually.
Secretary sut = new Secretary<TestEntity>
{
RootFolder = @"C:\test",
FileTypeHandled = FileType.File,
EntityPathBuilder = e => @"entities\" + e.Id.ToString(),
Entity = new TestEntity {Id = 1}
};