I've tried to
ObjectScope.GetSqlQuery("TRUNCATE TABLE %ta开发者_运维问答ble_name%", null, null).Execute();
and
ObjectScope.GetOqlQuery("TRUNCATE TABLE %ClassName%Extent").Execute();
The first row does nothing. And the second throw Exception:
line 1:10: unexpected token: ["TABLE",<42>,line=1,col=10]
Original Query: TRUNCATE TABLE DayExtent
The method ExecuteDDLScript doesn't make a difference between DDL and DML script. It only requires that there are no open object scopes.
IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();
//do something here
scope.Dispose();
string tableToTruncate = "SOME_TABLE";
scope.Database.GetSchemaHandler().ExecuteDDLScript(string.Format("TRUNCATE TABLE {0}", tableToTruncate));
scope = ObjectScopeProvider1.GetNewObjectScope();
//do something again
Hope that helps.
精彩评论