using System;
using Umbraco.Core;
using Umbraco.Core.Persistence;
namespace utData{
public class MyDB{
public string demo(){
var dataContext = new PetaPoco.Database("umbracoDbDSN");
return "demo - OK";
}
}
}
in my web service
public String dbTest()
{
string T;
T = "Latest testing";
MyDB d = new MyDB();
T = d.demo();
return T;
}
this crashes
CS0246: The type or namespace name 'PetaPoco' could not be found (are you missing a using directive or an assembly reference?)
var dataContext = new PetaPoco.Database("umbracoDbDSN");
Using petapoco from my own web service
I have created a cs file in App_Code
in my web service
this crashes
CS0246: The type or namespace name 'PetaPoco' could not be found (are you missing a using directive or an assembly reference?)
var dataContext = new PetaPoco.Database("umbracoDbDSN");
What am I missing in utData?
Hi Tim,
if you use umbraco core then you can use the Umbraco database context.
ApplicationContext.Current.DatabaseContext.Database.
There is no need to create a new database instance.
Regards David
is working on a reply...