我刚刚开始研究NHibernate 2天前,我正在寻找一个基于教程编写的CRUD方法.我的插入方法是:
using (ISession session = Contexto.OpenSession())
using (ITransaction transaction = session.BeginTransaction())
{
session.Save(noticia);
transaction.Commit();
session.Close();
}
Run Code Online (Sandbox Code Playgroud)
完整的"Contexto"代码在这里:http://codepaste.net/mrnoo5
我的问题是:我真的需要使用ITransaction transaction = session.BeginTransaction()和transaction.Commit(); ?
我问这个是因为我已经测试过运行没有这两行的网络应用程序,并且我已成功插入新记录.
如果可能的话,有人可以解释一下Itransaction的目的和方法提交吗?
谢谢
如何将此JSON转换为具有两个属性"id"和第二个"answer"的对象列表?
[["9","3"],["8","4"],["7","4"],["6","5"],["5","6"],["4","4"],["3","4"]]
Run Code Online (Sandbox Code Playgroud) 如果我将应用程序的数据访问部分从nhiberate替换为直接的ado.net,我会获得任何性能提升吗?
我知道NHibernate的核心是使用ado.net!
我试图将google admob sdk集成到以xml编写的android应用程序中展示广告.是的我已经确保按顺序检查admob jar并在构建路径下导出!
我意识到还有其他未解决的问题,但没有一个答案解决了我的问题!我没有错误,我的project.properties设置为目标19,我的清单有这样的:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
Run Code Online (Sandbox Code Playgroud)
我将发布我的整个主要布局页面请帮助我们!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageView1"
android:layout_centerVertical="true"
android:gravity="center"
android:text="@string/text_mainmenu"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adUnitId="[MYIDHERE]"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 为什么这个查询不起作用它总是返回一个空列表(映射是可以的,我确定数据库有数据!)任何想法?
var ids = //IList<int> of ids
var result = _session.CreateCriteria(typeof (User))
.Add(Restrictions.InG("Id", ids))
.CreateCriteria("Posts")
.AddOrder(Order.Asc("CreatedOn"))
.SetMaxResults(20)
.List<Post>();
Run Code Online (Sandbox Code Playgroud) 为什么以下代码使用Dev-C++编译器而不是Visual Studio编译?
任何的想法?这是代码:
#include<stdio.h>
main(){
int n,i;
scanf("%d",&n);
int arr[n];
for(i= 0 ; i <n ; i++)
{
//Do something with the array
}
fflush(stdin);
getchar();
}
Run Code Online (Sandbox Code Playgroud)
以下是错误:
nhibernate ×3
asp.net ×2
c ×2
c# ×2
admob ×1
ado.net ×1
android ×1
c#-3.0 ×1
dev-c++ ×1
httpmodule ×1
jquery ×1
json ×1
performance ×1
sdk ×1
xml ×1