RLINQ with objectscope provider....

2 posts, 0 answers
  1. Marchand
    Marchand avatar
    15 posts
    Member since:
    Sep 2008

    Posted 24 Nov 2010 Link to this post

    Hi,

    I want to set up container disconnect with my database.

    For example:
     public Telerik.OpenAccess.ObjectContainer.ChangeSet Get_All_Users_Container()
            {
                try
                {
                    ObjectContainer.ChangeSet ccData = null;
                    IObjectScope os = ISSYS_Qualification_BO.ObjectScopeProvider.GetNewObjectScope();

                    os.Transaction.Begin();
                    try
                    {
                        string resultName = "User";
                        string query = "SELECT * FROM UserExtent AS x";
                        IQuery qry = os.GetOqlQuery(query);
                        IQueryResult qres = qry.Execute();

                        ObjectContainer oc = new ObjectContainer();

                        // default deep
                        Telerik.OpenAccess.IObjectCollector objCollector =
                            new FetchGroupCollector(FetchGroupCollector.DefaultFetchGroup);

    ........
    I can not make the connection between my schema "EntityDiagrams1.rlinq" and my class provider ? My query failed, i think that my scope doesn't know my table ?

    I souhaitairais implement a class "ObjectScopeProvider" tied to a schema "EntityDiagrams1.rlinq. Is this possible?

    Another question :
    1- I create my database schéma in the entitydiagram.
    2- I create my SQL database with my entitydiagram
    3 - I add somme data in my database
    4 - I want to update my entitydiagram ==> I update my entity diagram, I add some properties....
    5 - It is possible to update my database structure that contain some datas ? I think, no I have a message that say, taht there ara some data in my database ! If it is possible.....How ? Thanks

    How can I do.

    In advance thank you.
    Richard

  2. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 26 Nov 2010 Link to this post

    Hello Marchand,

    The OpenAccess disconnected API is related to the classic scope approach. Instead of using an ObjectScopeProvider, you can do the trick with which to expose a scope which is related to the OpenAccessContext. The generated class for the domain context is a partial one, so you can extend its definition in a separate file (so that the code generation does not clear your changes):
    public partial class NorthwindEntityDiagrams : OpenAccessContext
    {
        public IObjectScope GetInternalScope()
        {
            return this.GetScope();
        }
    }
    You can expose the method GetScope().
    With regard to the update of the database I am not sure I understand what exactly your situation is. Are you trying to add additional properties to the entities and then forward map them to columns in the database while you have data in the tables? There are cases when adding a column (which cannot be null and does not provide default values) will result in a database server error - one case is when the table is populated with some data. The existing data should also have values for the column but since the value cannot be null, the database does not know what values to place and an error is generated.

    We would mostly welcome any additional information you can give us regarding the exception you receive. We are looking forward to your reply.

    Best wishes,
    Petko_I
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  3. DevCraft banner
Back to Top