How get the data from database with xpo (devexpress)?

r0guegamer

New Member
I'm a newbie with devexpress and i have a few difficulty.I have create a project ".net empty c#" with visual studio. I would like connect at my database "mysql" with "devexpress xpo".
I create a "dxperience orm data model wizard" to connect at my database.At the end i have a "connectionHelper.cs"(with few method static) and a class with the name of my table.But I not understand , how connect,read,write,... at the database with the connectionHelper?I read the documentation of devexpress but I not have the same result.thank you in advanceThe class connection helper:\[code\]using DevExpress.Xpo;using DevExpress.Data.Filtering;namespace ProduWebEmpty.produweb{ public static class ConnectionHelper { public const string ConnectionString = @"XpoProvider=MySql;server=localhost;user id=root; password=; database=web;persist security info=true;CharSet=utf8;"; public static void Connect(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption) { XpoDefault.DataLayer = XpoDefault.GetDataLayer(ConnectionString, autoCreateOption); XpoDefault.Session = null; } public static DevExpress.Xpo.DB.IDataStore GetConnectionProvider(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption) { return XpoDefault.GetConnectionProvider(ConnectionString, autoCreateOption); } public static DevExpress.Xpo.DB.IDataStore GetConnectionProvider(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption, out IDisposable[] objectsToDisposeOnDisconnect) { return XpoDefault.GetConnectionProvider(ConnectionString, autoCreateOption, out objectsToDisposeOnDisconnect); } public static IDataLayer GetDataLayer(DevExpress.Xpo.DB.AutoCreateOption autoCreateOption) { return XpoDefault.GetDataLayer(ConnectionString, autoCreateOption); } }}\[/code\]The class authentification.cs (authentification is the name of my table into my database)\[code\]using DevExpress.Xpo;using DevExpress.Data.Filtering;namespace ProduWebEmpty.produweb{ public partial class authentification { public authentification(Session session) : base(session) { } public authentification() : base(Session.DefaultSession) { } public override void AfterConstruction() { base.AfterConstruction(); } }}\[/code\]The class authentification.designer.cs:\[code\]using DevExpress.Xpo;using DevExpress.Data.Filtering;namespace ProduWebEmpty.produweb{ public partial class authentification : XPLiteObject { int fId; [Key(true)] public int Id { get { return fId; } set { SetPropertyValue<int>("Id", ref fId, value); } } string fPseudo; [Size(255)] public string Pseudo { get { return fPseudo; } set { SetPropertyValue<string>("Pseudo", ref fPseudo, value); } } string fMotDePasse; [Size(255)] public string MotDePasse { get { return fMotDePasse; } set { SetPropertyValue<string>("MotDePasse", ref fMotDePasse, value); } } string fEmail; [Size(255)] public string Email { get { return fEmail; } set { SetPropertyValue<string>("Email", ref fEmail, value); } } }}\[/code\]
 
Back
Top