Beispiel #1
0
        public void Build(SFTContainer isftsEntity, string description, object tag)
        {
            //build List ISFTs entity

            SFTContainer            = isftsEntity;
            SFTContainer.FacadeName = isftsEntity.FacadeType.FullName;
            SFTContainer.Add(this);

            // description set later after name found...
            SFTEntityInstance = new SFTEntity {
                Key = SFTContainer.Size() - 1, Tag = tag
            };

            // build support...

            // get the facade's public items using reflection (names of the SFTs)
            var sftNames = SFTContainer.FacadeType
                           .GetFields(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Static)
                           .Select(f => f.Name)
                           .ToList();

            // this method is called for each SFT, so process only if not yet processed;
            // eg, if SFTs are aaa bbb ccc, then 1st time through aaa is set,
            // 2nd time through with aaa already set, set bbb,
            // final time through with aaa and bbb already set, finish by setting ccc;
            // go through each SFT, advancing the current field name pointer if field name already set,
            // otherwise if SFT name is empty then add current field name
            var eFieldName = sftNames.GetEnumerator();

            eFieldName.MoveNext();
            var isftEntity = SFTContainer.Enumerator();

            while (isftEntity.MoveNext())
            {
                var sftPrototype = isftEntity.Current as SFTPrototype;
                if (sftPrototype == null || string.IsNullOrEmpty(sftPrototype.Name))
                {
                    SFTEntityInstance.Name = eFieldName.Current;
                    break;
                }
                // conditional necessary for extended SFTs;
                // extended SFTs need to skip over base ISFTEntity's before advancing the SFT field name
                if (sftPrototype.Name == eFieldName.Current)
                {
                    eFieldName.MoveNext();
                }
            }
            // if description empty, then set it to name
            SFTEntityInstance.Description = String.IsNullOrEmpty(description) ? SFTEntityInstance.Name : description;
        }
Beispiel #2
0
 public ISFT Match(string @string)
 {
     return(SFTContainer.Match(@string));
 }
Beispiel #3
0
 public ISFT Match(int key)
 {
     return(SFTContainer.Match(key));
 }
Beispiel #4
0
 public ISFT Match(ISFT isft)
 {
     return(SFTContainer.Match(isft));
 }
Beispiel #5
0
 public IEnumerator Enumerator()
 {
     return(SFTContainer.Enumerator());
 }
Beispiel #6
0
 public int Size()
 {
     return(SFTContainer.Size());
 }
Beispiel #7
0
 public ISFT NextItem()
 {
     return(SFTContainer.Match(SFTEntityInstance.Key + 1));
 }
Beispiel #8
0
 public ISFT FirstItem()
 {
     return(SFTContainer.FirstItem());
 }
Beispiel #9
0
 public SFTPrototype(SFTContainer isftsEntity, string description, object tag)
 {
     Build(isftsEntity, description, tag);
 }
Beispiel #10
0
 public SFTPrototype(SFTContainer isftsEntity, string description)
     : this(isftsEntity, description, null)
 {
 }
Beispiel #11
0
 // for inherited facades
 public SFTPrototype(Type facadeType, SFTContainer isftsEntity, string description, object tag)
 {
     isftsEntity.FacadeType = facadeType;
     Build(isftsEntity, description, tag);
 }
Beispiel #12
0
 public List <ISFT> ToList()
 {
     return(SFTContainer.ToList());
 }
Beispiel #13
0
 public List <string> Descriptions()
 {
     return(SFTContainer.Descriptions());
 }
Beispiel #14
0
 public SFTPrototype(Type facadeType, SFTContainer isftsEntity, string description)
     : this(facadeType, isftsEntity, description, null)
 {
 }