我有DAL,我将数据库空值转换为它们在C#中的等效表示.例如:
NULL for Numeric = 0
NULL for String = String.Empty
NULL for DateTime = "1/1/0001" (i.e. DateTime.MinValue)
Run Code Online (Sandbox Code Playgroud)
对于日期而言,问题在于表示层,尤其是在GridViews中.您无法1/1/01
向用户显示.
我以前做的是检查if myDate.Year=1 or myDate.Year < AcceptedDate
并显示空字符串,但与其他类型不同,似乎是额外的努力
请接受更好的方法.谢谢.
我正在使用自己的API,我希望使用RxJava链接一些分页结果.我使用基于游标的分页.(想象有50个用户):
{
"data":{
"status":"ok",
"total":988, //users total
"has_next_page":true,
"end_cursor":"AQAxd8QPGHum7LSDz8DnwIh7yHJDM22nEjd",
"users":[{"id":"91273813",
"username":"codergirl",
"full_name":"Code Girl",
"picture_url":"https://cdn.com/21603182_7904715668509949952_n.jpg",
},
...
]
}
}
Run Code Online (Sandbox Code Playgroud)
现在,我正在使用改造这样的前50个结果:
public class DataResponse {
@SerializedName("end_cursor")
private String end_cursor;
@SerializedName("users")
private JsonArray users;
@SerializedName("has_next_page")
private Boolean has_next_page;
public boolean hasNextCursor(){
return has_next_page;
}
public String endCursor(){
if (hasNextCursor()){
return end_cursor;
}
return "";
}
public JsonArray getUsers(){
return users;
}
}
Run Code Online (Sandbox Code Playgroud)
然后:
public interface MyService {
@GET( "/users")
Observable<DataResponse> getUsers(
@Query("cursor") String cursor,
);
}
Run Code Online (Sandbox Code Playgroud)
和
MyService service = RetrofitClient.getInstance();
service.getUsers() …
Run Code Online (Sandbox Code Playgroud) android ×1
asp.net ×1
c# ×1
data-formats ×1
database ×1
flatmap ×1
pagination ×1
retrofit ×1
rx-java2 ×1