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);
        }
Esempio n. 2
0
 public void IsValidType_WhenObjectType_ReturnsFalse()
 {
     Assert.IsFalse(StructureId.IsValidDataType(typeof(object)));
 }
Esempio n. 3
0
 public void IsValidType_WhenNullableLong_ReturnsTrue()
 {
     Assert.IsTrue(StructureId.IsValidDataType(typeof(long?)));
 }
Esempio n. 4
0
 public void IsValidType_WhenInt_ReturnsTrue()
 {
     Assert.IsTrue(StructureId.IsValidDataType(typeof(int)));
 }
Esempio n. 5
0
 public void IsValidType_WhenGuid_ReturnsTrue()
 {
     Assert.IsTrue(StructureId.IsValidDataType(typeof(Guid)));
 }
Esempio n. 6
0
 public void IsValidType_WhenString_ReturnsTrue()
 {
     Assert.IsTrue(StructureId.IsValidDataType(typeof(string)));
 }