Show / Hide Table of Contents

    ILoadable.ToList Method

    .NET Standard 2.x

    Creates a List<TModel> object from the result set.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

      List<TModel> ToList();
    

    Returns

    System.Collections.Generic.List<TModel>

    Returns a List<TModel> object that includes all of the data of the result set.

    Examples

    The following code example demonstrates how to get a list of students.

    using Appeon.ApiDoc.Models.School;
    
    namespace Appeon.ApiDoc.ILoadableExamples
    {
        public class ToListExample
        {
            private SchoolContext _context;
    
            public ToListExample(SchoolContext dataContext)
            {
                // Sets the data context.
                _context = dataContext;
            }
    
            public void Example()
            {
                var loadable = _context.SqlModelMapper.Load<Student>();
    
                // Creates a List<Student> that includes the data of the result set.
                var students = loadable.ToList();
            }
        }
    }
    

    Example Refer To

    Model Class: Student

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon