public IdAccessor(IStructureProperty property)
            : base(property)
        {
            if (!property.IsRootMember)
            {
                throw new SisoDbException(ExceptionMessages.IdAccessor_InvalidLevel);
            }

            if (!StructureId.IsValidDataType(property.DataType))
            {
                throw new SisoDbException(ExceptionMessages.IdAccessor_UnsupportedPropertyType.Inject(Property.DataType.Name));
            }

            IdType = StructureId.GetIdTypeFrom(property.DataType);

            _getter = StructureIdGetters.For(IdType, Property.DataType);
            _setter = StructureIdSetters.For(IdType, Property.DataType);
        }
示例#2
0
 public void IsValidType_WhenObjectType_ReturnsFalse()
 {
     Assert.IsFalse(StructureId.IsValidDataType(typeof(object)));
 }
示例#3
0
 public void IsValidType_WhenNullableLong_ReturnsTrue()
 {
     Assert.IsTrue(StructureId.IsValidDataType(typeof(long?)));
 }
示例#4
0
 public void IsValidType_WhenInt_ReturnsTrue()
 {
     Assert.IsTrue(StructureId.IsValidDataType(typeof(int)));
 }
示例#5
0
 public void IsValidType_WhenGuid_ReturnsTrue()
 {
     Assert.IsTrue(StructureId.IsValidDataType(typeof(Guid)));
 }
示例#6
0
 public void IsValidType_WhenString_ReturnsTrue()
 {
     Assert.IsTrue(StructureId.IsValidDataType(typeof(string)));
 }