lxh023

Results 9 comments of lxh023

我知道原因了,是在..\app\src\main\res\values下有一个color.xml, ` #008577 #00574B #D81B60` 第一项跟第二项就是绿色、深绿色。。。。 把这三项改为 ` #3F51B5 #303F9F #FF4081` 就可以了。样式颜色的问题

补充一下,是针对postgresql场景,发现不但表名Name失效,连列名也失效了, 还要增加 fsql.Aop.ConfigEntityProperty += (s, e) => { var attr = e.Property.GetCustomAttributes(typeof(MyColumnAttribute), false).FirstOrDefault() as MyColumnAttribute; if (attr != null && e.ModifyResult.Name != attr.Name) e.ModifyResult.Name = attr.Name; //字段名 };

![Snipaste_2022-09-16_12-30-38](https://user-images.githubusercontent.com/8578755/190557124-2ee5d822-ac3c-4560-9642-f5c6d782d623.png)

大佬牛逼,测试可以了,但还是有个问题 。 fsql.Aop.ConfigEntityProperty += (s, e) => { var attr = e.Property.GetCustomAttributes(typeof(MyColumnAttribute), false).FirstOrDefault() as MyColumnAttribute; if (attr != null && e.ModifyResult.Name != attr.Name) e.ModifyResult.Name = attr.Name; //字段名 }; 这部分FluentApi代码,不知道要怎么实现,查了一下,ICodeFirst好像没有获取ColumnAttributer的方法

![Snipaste_2022-09-18_01-46-58](https://user-images.githubusercontent.com/8578755/190869848-60b72613-fd96-4dfa-982e-894b947f59ec.png) ---------------------------- _PostgreSqlFreeSql.Aop.ConfigEntityProperty += (s, e) => { var attr = e.Property.GetCustomAttributes(typeof(ColumnAttribute), false).FirstOrDefault() as ColumnAttribute; if (attr != null && (string.IsNullOrEmpty(e.ModifyResult.Name) || (!string.IsNullOrEmpty(e.ModifyResult.Name) && !e.ModifyResult.Name.Equals(attr.Name)))) e.ModifyResult.Name = attr.Name; }; 看文档的方法,反射获取为空,大佬还有其他办法吗?

这个还是没办法出来。读了一下源码,并加到项目上打断点,发现有几个奇怪的地方: 1、\FreeSql\Internal\CommonUtils.cs,这个文件,_mappingPriorityTypes 似乎写死了,并没有应用FreeSqlBuilder.UseMappingPriority的传值 2、\FreeSql\DataAnnotations\TableAttribute.cs,这个TableAttribute类并没有提供_columns的方法,兄弟不才,加了一个函数getColumns() ![Snipaste_2022-09-19_01-11-44](https://user-images.githubusercontent.com/8578755/190919787-eb78d78b-5588-4696-95ac-0451a802854c.png) public ConcurrentDictionary getColumns() { return _columns; } 最终试验成功 ![Snipaste_2022-09-19_01-14-05](https://user-images.githubusercontent.com/8578755/190919876-60548653-25ab-44ae-b6b4-7f791d8a2fa9.png) 关键代码如下: _PostgreSqlFreeSql.Aop.ConfigEntity += (s, e) => { var attr = e.EntityType.GetCustomAttribute()?? //特性 _PostgreSqlFreeSql.CodeFirst.GetConfigEntity(e.EntityType); ////FluentApi if (attr...

`插表中,对于表中,对于日期型的可空字段,freesql 会插入0001-01-01 00:00:00` ---- 这个搞定了,只需要在fluentApi中设定.InsertValueSql("null")就可以了,现在的需求是,能否指定默认表空间及索引空间?

不会,哈哈,先用。具体怎么用呢?

> ## `插表中,对于表中,对于日期型的可空字段,freesql 会插入0001-01-01 00:00:00` > 这个搞定了,只需要在fluentApi中设定.InsertValueSql("null")就可以了,现在的需求是,能否指定默认表空间及索引空间? 发现对于DateTime?的字段在MapType(typeof(DateTIme)下,.IsNull(true).InsertValueSql("null") 是没效果的,必须是在 DbType="timestamp(6)",在null情况下才起效果。