Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Training Secretaries

scottmuc edited this page Sep 13, 2010 · 4 revisions

Step 1 Is To Enroll

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.

Graduation

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();

Home Schooling

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} 
};
Clone this wiki locally