有案例类+光滑表映射。
很多课程使用相同的字段,例如
class T1(tag: Tag) extends Table[caseClassA](tag, "A") {
def id = column[Option[Long]]("ID", O.PrimaryKey, O.AutoInc)
def id1 = column[Long]("ID1", O.NotNull)
def id2 = column[String]("ID2", O.NotNull)
def idn = column[String]("IDn", O.NotNull)
}
class T2(tag: Tag) extends Table[caseClassB](tag, "B") {
def id = column[Option[Long]]("ID", O.PrimaryKey, O.AutoInc)
def id1 = column[Long]("ID1", O.NotNull)
def id2 = column[String]("ID2", O.NotNull)
def idn = column[String]("IDn", O.NotNull)
}
如何将id, id1, id2, idn
移动到根线程?
尝试
trait BasicT extends Table {
...
}
没有成功,有什么想法吗?
BR!
答案 0 :(得分:0)
您可以将这些字段提取到trait
,而Table
本身不必扩展trait BasicT {
def id = column[Option[Long]]("ID", O.PrimaryKey, O.AutoInc)
def id1 = column[Long]("ID1", O.NotNull)
def id2 = column[String]("ID2", O.NotNull)
def idn = column[String]("IDn", O.NotNull)
}
class T1(tag: Tag) extends Table[caseClassA](tag, "A") with BasicT
class T2(tag: Tag) extends Table[caseClassB](tag, "B") with BasicT
。
@Override
public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) {
handler.proceed(StringUtils.AUTH_NAME,StringUtils.AUTH_PASS);
}
答案 1 :(得分:0)
为了能够使用column
,您的特质必须知道它会混合到Table
个实例:
trait BasicT {
self: Table[_] =>
def id = column[Option[Long]]("ID", O.PrimaryKey, O.AutoInc)
def id1 = column[Long]("ID1", O.NotNull)
def id2 = column[String]("ID2", O.NotNull)
def idn = column[String]("IDn", O.NotNull)
}
class T1(tag: Tag) extends Table[caseClassA](tag, "A") with BasicT
class T2(tag: Tag) extends Table[caseClassB](tag, "B") with BasicT
答案 2 :(得分:0)
考虑到抽象表实际上需要参数的事实,抽象类可能是统一公共字段的更好选择。
var processes=Process.GetProcessByName( "AppName" );
foreach(var process in processes )
process.Kill();