.NET controller but don't need to edit

.NET controller but don't need to edit

montoyammontoyam Posts: 568Questions: 136Answers: 5

I have a .net project in which there is one table on the page that is not editable. Each example I see here for MVC uses:

            using (var db = new Database(settings.DbType, settings.DbConnection))
            {
                   var response = new Editor(db, "tableName", "PrimaryIDName")

I'm thinking you still need a Model and Controller even though you don't need an Editor, but do you use different syntax than the one above?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin
    Answer ✓

    You could use our .NET libraries (with the Editor) class just to read the table if you wanted - just be sure to add .Set(false) to each field to disallow some wise guy from attempting to write to your db!

    Alternatively, if you don't want to use our Editor class, then you can query the database however you want (EF, ADO, whatever) and return JSON to the client-side, which DataTables can then use. DataTables is a client-side library and doesn't "care" (in so much as software can care!) what the data source is. We provide the Editor server-side class to make things easier when you are using Editor, but it isn't required.

    Allan

This discussion has been closed.