Closed HelloZhu closed 6 years ago
initialize 时候删除就好。见demo里的LKTestModels
//在类 初始化的时候
+(void)initialize
{
//remove unwant property
//比如 getTableMapping 返回nil 的时候 会取全部属性 这时候 就可以 用这个方法 移除掉 不要的属性
[self removePropertyWithColumnName:@"error"];
//simple set a column as "LKSQL_Mapping_UserCalculate"
//根据 属性名 来启用自己计算
//[self setUserCalculateForCN:@"error"];
//根据 属性类型 来启用自己计算
//[self setUserCalculateForPTN:@"NSDictionary"];
//enable own calculations
//[self setUserCalculateForCN:@"address"];
//enable the column binding property name
[self setTableColumnName:@"MyAge" bindingPropertyName:@"age"];
[self setTableColumnName:@"MyDate" bindingPropertyName:@"date"];
}
属性是readonly的会过滤掉。
///过滤只读属性
if ([propertyType rangeOfString:@",R,"].length > 0 || [propertyType hasSuffix:@",R"]) {
NSString *firstWord = [[propertyName substringToIndex:1] uppercaseString];
NSString *otherWord = [propertyName substringFromIndex:1];
NSString *setMethodString = [NSString stringWithFormat:@"set%@%@:", firstWord, otherWord];
SEL setSEL = NSSelectorFromString(setMethodString);
///有set方法就不过滤了
if ([self instancesRespondToSelector:setSEL] == NO) {
continue;
}
}
有没有过滤不需要写入数据库的属性的功能