【发布时间】:2017-10-26 12:47:10
【问题描述】:
我正在尝试将使用 ORMLite 的 Android 代码库转换为使用 SQLite-net PCL nuget 包的 Xamarin.Android 的 C# 等效代码。
Java:
public abstract class DTAbstractEntity {
}
import entities.DTAbstractEntity;
import com.j256.ormlite.field.DatabaseField;
public abstract class DTAbstractModelEntity<T extends DTAbstractEntity> extends DTAbstractEntity {
public final static String ID_FIELD_NAME = "uuid";
@DatabaseField(id = true, canBeNull = false, columnName = ID_FIELD_NAME)
protected String uuid;
@DatabaseField
protected String name;
@DatabaseField
protected String path;
@DatabaseField
protected boolean completeResponse;
/* GETTERS */
public String getUuid() { return uuid; }
public String getName() {
return name;
}
public String getPath() {
return path;
}
public boolean isCompleteResponse() {
return completeResponse;
}
}
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
@DatabaseTable
public class DTProfile extends DTAbstractModelEntity {
@DatabaseField
private int unreadCount;
@DatabaseField
private boolean linkedInAuthorised;
@DatabaseField
private boolean hasSubscriptions;
@DatabaseField(foreign=true, foreignAutoCreate = true, foreignAutoRefresh = true)
private DTLocale localePreference;
@DatabaseField
private String loginType; //email or social login provider ie twitter, google, facebook etc
/* CONSTRUCTOR */
public DTProfile() {
//constructor stub - needed by ORMLite
}
/* GETTERS */
public int getUnreadCount() {
return unreadCount;
}
public boolean isLinkedInAuthorised() {
return linkedInAuthorised;
}
public boolean isHasSubscriptions() {
return hasSubscriptions;
}
public DTLocale getLocalePreference() {
return localePreference;
}
public String getLoginType() { return loginType; }
}
任何人都可以在这里提供他们的指导,以将 Java 代码迁移到其 C# 等效项
【问题讨论】:
标签: android xamarin.android ormlite sqlite-net