Reputation: 1
I created an ADO.NET Entity Data Model using Entity Framework code-first in a RevitAddin
project.
public static class ElevationDao
{
public static int GetId(int length)
{
var db = new DbContext();
var obj = db.Elevations.Where(x => x.Value == length);
if (obj.Count() == 0)
throw new Exception();
return obj.First().ID;
}
}
And I call this function in Execute
method of Revit command:
[Transaction(TransactionMode.Manual)]
public class Class1 : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
int id = ElevationDao.GetId(3300);
return Result.Succeeded;
}
}
When I execute this command, Revit throws a NotSupportException
and automatically shuts down its session.
Can anyone explain this and give me a hint? Thank you.
PS: It only happens on my laptop, On my company's computer, it works fine.
Upvotes: 0
Views: 220