Пример #1
0
        private static AlignmentModel Create(DbDataReader reader)
        {
            AlignmentModel model;

            model = new AlignmentModel();
            model.Load(reader);

            return(model);
        }
Пример #2
0
        /// <summary>
        /// Loads the specified reader.
        /// </summary>
        /// <param name="reader">The reader.</param>
        protected override void Load(DbDataReader reader)
        {
            int ordinal;

            if (reader == null)
            {
                return;
            }

            if (!reader.TryGetOrdinal(ClassModel.IdField, out ordinal))
            {
                // No ID field, can't use
                return;
            }

            if (reader.IsDBNull(ordinal))
            {
                // Null, can't use
                return;
            }

            Id = reader.GetGuid(ordinal);

            if (reader.TryGetOrdinal(ClassModel.NameField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    Name = reader.GetString(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.AbbreviationField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    Abbreviation = reader.GetString(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.DescriptionField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    Description = reader.GetString(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.HitDieField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    HitDie = reader.GetByte(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.SkillPointsField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    SkillPoints = reader.GetByte(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.StartingDestinySphereIdField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    StartingDestinySphereId = reader.GetGuid(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.ReincarnationPriorityField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    ReincarnationPriority = reader.GetByte(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.ImageFileNameField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    ImageFilename = reader.GetString(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.LastUpdatedDateField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    LastUpdatedDate = reader.GetDateTime(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.LastUpdatedVersionField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    LastUpdatedVersion = reader.GetString(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.SequenceField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    Sequence = reader.GetByte(ordinal);
                }
            }

            if (reader.TryGetOrdinal(ClassModel.MaxSpellLevelField, out ordinal))
            {
                if (!reader.IsDBNull(ordinal))
                {
                    MaxSpellLevel = reader.GetByte(ordinal);
                }
            }


            AllowedAlignments = AlignmentModel.GetAllForClass(Id);
            ClassSkills       = SkillModel.GetAllForClass(Id);
            LevelDetails      = ClassLevelDetailModel.GetAll(Id).ToArray();
        }