how to make crud(create,update,delete) and insert in sitefinity 4.0 ? - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

how to make crud(create,update,delete) and insert in sitefinity 4.0 ?

  • how to make crud(create,update,delete) and insert in sitefinity 4.0 ?
  • hi,

    how to make crud(create,update,delete) and insert in our own table using in sitefinity 4.0 ? in sitefinity 3.7,we can create and module with our own table and perform action(like contacts module). but how can we do in sitefinity 4.0 rc ?


    thanks
    Humayoo
  • Hi humayoo,

    You can use the API to create CRUD operations. The "Contacts Module" in Sitefinity 3.x  comes with its own data persistence classes , so in Sitefinity 4.0 you have to create a custom data layer using Open Access ORM for a custom module  that inherits from ModuleBase class.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  • HI,

    please provide some working example ? how to make Module using Open Access ORM  like contacts module in sitefinity 3.7 ?

    thanks
    Humayoo
  • Hi humayoo,

    We will provide a sample with the official release. Creating a custom module in not something trivial. Open Access is a data layer, so you need to have methods where you persists your data using the Open Access API.

    Below is a sample with CRUD data operations where OA is used

    public override CustomDataType CreateObject(Guid id)
     
         var ob = new CustomDataType(this.ApplicationName, id);
         
         if (id != Guid.Empty)
         
             this.GetScope().Add(ob);
         
         return ob;
     
     
     
     public override CustomDataType GetObject(Guid id)
     
         if (id == Guid.Empty)
             throw new ArgumentException("Id cannot be Empty Guid");
     
         var ob = this.GetScope().GetItemById<Blog>(id.ToString());
         ((IDataItem)ob).Provider = this;
         return ob;
     
     
     
     
     /// <summary>
      
     public override void Delete(CustomDataType objToDelete)
     
         var scope = this.GetScope();
      
         if (scope != null)
             scope.Remove(objToDelete);
     


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.