Deprecated: Creation of dynamic property Kirki_Toolkit::$modules is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/kirki.php on line 67

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Textarea::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Toggle::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Custom::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Custom::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio_Image::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Multicheck::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Number::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Text::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio_Image::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Multicheck::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio_Image::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Custom::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Custom::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Warning: Cannot modify header information - headers already sent by (output started at /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php:291) in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-includes/feed-rss2.php on line 8
skip in entity framework Archives - OctopusCodes https://octopuscodes.com/tag/skip-in-entity-framework/ Fri, 12 May 2023 08:44:21 +0000 en-US hourly 1 https://wordpress.org/?v=6.9 https://octopuscodes.com/wp-content/uploads/2022/12/cropped-logo-80x80-1-32x32.png skip in entity framework Archives - OctopusCodes https://octopuscodes.com/tag/skip-in-entity-framework/ 32 32 Skip in Raw SQL Queries in Entity Framework Core https://octopuscodes.com/net-core-tutorial/entity-framework-core-tutorial/skip-in-raw-sql-queries-in-entity-framework-core/ Fri, 12 May 2023 08:34:24 +0000 https://octopuscodes.com/?p=2329 Use Skip method allows to skip or bypass the first n number of elements from a database and then returns the remaining elements from the database as output using Entity …

The post Skip in Raw SQL Queries in Entity Framework Core appeared first on OctopusCodes.

]]>
Use Skip method allows to skip or bypass the first n number of elements from a database and then returns the remaining elements from the database as output using Entity Framework Core.

using EntityFrameworkCore_ConsoleApp.Models;
using Microsoft.EntityFrameworkCore;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = databaseContext.Products.FromSqlRaw("select * from product").Skip(2).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("Quantity: " + product.Quantity);
                    Console.WriteLine("Description: " + product.Description);
                    Console.WriteLine("Status: " + product.Status);
                    Console.WriteLine("Photo: " + product.Photo);
                    Console.WriteLine("Created: " + product.Created.ToString("dd/MM/yyyy"));
                    Console.WriteLine("Category Id: " + product.CategoryId);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 11
Name: Tivi 3
Price: 20
Quantity: 4
Description: Description 2
Status: False
Photo: photo3.gif
Created: 20/11/2022
Category Id: 1
---------------------
Id: 12
Name: Laptop 1
Price: 15
Quantity: 16
Description: Description 3
Status: True
Photo: photo4.gif
Created: 20/10/2021
Category Id: 2
---------------------
Id: 13
Name: Laptop 2
Price: 4
Quantity: 26
Description: Description 4
Status: False
Photo: photo5.gif
Created: 20/10/2022
Category Id: 2
---------------------
Id: 14
Name: Computer 1
Price: 17
Quantity: 34
Description: Description 5
Status: True
Photo: photo6.gif
Created: 20/12/2023
Category Id: 3
---------------------
Id: 15
Name: Computer 2
Price: 43
Quantity: 11
Description: Description 6
Status: False
Photo: photo7.gif
Created: 20/11/2023
Category Id: 3
---------------------
Id: 16
Name: Computer 3
Price: 19
Quantity: 18
Description: Description 7
Status: True
Photo: photo8.gif
Created: 20/05/2023
Category Id: 3
---------------------

You can use combination of Skip method and Take method as below:

using EntityFrameworkCore_ConsoleApp.Models;
using Microsoft.EntityFrameworkCore;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = databaseContext.Products.FromSqlRaw("select * from product").Skip(2).Take(3).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("Quantity: " + product.Quantity);
                    Console.WriteLine("Description: " + product.Description);
                    Console.WriteLine("Status: " + product.Status);
                    Console.WriteLine("Photo: " + product.Photo);
                    Console.WriteLine("Created: " + product.Created.ToString("dd/MM/yyyy"));
                    Console.WriteLine("Category Id: " + product.CategoryId);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 11
Name: Tivi 3
Price: 20
Quantity: 4
Description: Description 2
Status: False
Photo: photo3.gif
Created: 20/11/2022
Category Id: 1
---------------------
Id: 12
Name: Laptop 1
Price: 15
Quantity: 16
Description: Description 3
Status: True
Photo: photo4.gif
Created: 20/10/2021
Category Id: 2
---------------------
Id: 13
Name: Laptop 2
Price: 4
Quantity: 26
Description: Description 4
Status: False
Photo: photo5.gif
Created: 20/10/2022
Category Id: 2
---------------------

You can use combination of Skip method and Take method and Where as below:

using EntityFrameworkCore_ConsoleApp.Models;
using Microsoft.EntityFrameworkCore;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = databaseContext.Products.FromSqlRaw("select * from product where status = {0}", true).Skip(1).Take(2).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("Quantity: " + product.Quantity);
                    Console.WriteLine("Description: " + product.Description);
                    Console.WriteLine("Status: " + product.Status);
                    Console.WriteLine("Photo: " + product.Photo);
                    Console.WriteLine("Created: " + product.Created.ToString("dd/MM/yyyy"));
                    Console.WriteLine("Category Id: " + product.CategoryId);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 12
Name: Laptop 1
Price: 15
Quantity: 16
Description: Description 3
Status: True
Photo: photo4.gif
Created: 20/10/2021
Category Id: 2
---------------------
Id: 14
Name: Computer 1
Price: 17
Quantity: 34
Description: Description 5
Status: True
Photo: photo6.gif
Created: 20/12/2023
Category Id: 3
---------------------

You can use combination of Skip method and Take method and Where and OrderBy method as below:

using EntityFrameworkCore_ConsoleApp.Models;
using Microsoft.EntityFrameworkCore;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = databaseContext.Products.FromSqlRaw("select * from product where status = {0}", true).OrderBy(product => product.Price).Skip(1).Take(2).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("Quantity: " + product.Quantity);
                    Console.WriteLine("Description: " + product.Description);
                    Console.WriteLine("Status: " + product.Status);
                    Console.WriteLine("Photo: " + product.Photo);
                    Console.WriteLine("Created: " + product.Created.ToString("dd/MM/yyyy"));
                    Console.WriteLine("Category Id: " + product.CategoryId);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 12
Name: Laptop 1
Price: 15
Quantity: 16
Description: Description 3
Status: True
Photo: photo4.gif
Created: 20/10/2021
Category Id: 2
---------------------
Id: 14
Name: Computer 1
Price: 17
Quantity: 34
Description: Description 5
Status: True
Photo: photo6.gif
Created: 20/12/2023
Category Id: 3
---------------------

The post Skip in Raw SQL Queries in Entity Framework Core appeared first on OctopusCodes.

]]>
Skip in LINQ Query in Entity Framework Core https://octopuscodes.com/net-core-tutorial/entity-framework-core-tutorial/skip-in-linq-query-in-entity-framework-core/ Thu, 27 Apr 2023 02:39:48 +0000 https://octopuscodes.com/?p=2087 Use Skip method allows to skip or bypass the first n number of elements from a database and then returns the remaining elements from the database as output using Entity …

The post Skip in LINQ Query in Entity Framework Core appeared first on OctopusCodes.

]]>
Use Skip method allows to skip or bypass the first n number of elements from a database and then returns the remaining elements from the database as output using Entity Framework Core.

using EntityFrameworkCore_ConsoleApp.Models;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = (from product in databaseContext.Products
                                select product).Skip(2).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("Quantity: " + product.Quantity);
                    Console.WriteLine("Description: " + product.Description);
                    Console.WriteLine("Status: " + product.Status);
                    Console.WriteLine("Photo: " + product.Photo);
                    Console.WriteLine("Created: " + product.Created.ToString("dd/MM/yyyy"));
                    Console.WriteLine("Category Id: " + product.CategoryId);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 11
Name: Tivi 3
Price: 20
Quantity: 4
Description: Description 2
Status: False
Photo: photo3.gif
Created: 20/11/2022
Category Id: 1
---------------------
Id: 12
Name: Laptop 1
Price: 15
Quantity: 16
Description: Description 3
Status: True
Photo: photo4.gif
Created: 20/10/2021
Category Id: 2
---------------------
Id: 13
Name: Laptop 2
Price: 4
Quantity: 26
Description: Description 4
Status: False
Photo: photo5.gif
Created: 20/10/2022
Category Id: 2
---------------------
Id: 14
Name: Computer 1
Price: 17
Quantity: 34
Description: Description 5
Status: True
Photo: photo6.gif
Created: 20/12/2023
Category Id: 3
---------------------
Id: 15
Name: Computer 2
Price: 43
Quantity: 11
Description: Description 6
Status: False
Photo: photo7.gif
Created: 20/11/2023
Category Id: 3
---------------------
Id: 16
Name: Computer 3
Price: 19
Quantity: 18
Description: Description 7
Status: True
Photo: photo8.gif
Created: 20/05/2023
Category Id: 3
---------------------

You can use combination of Skip method and Take method as below:

using EntityFrameworkCore_ConsoleApp.Models;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = (from product in databaseContext.Products
                                select product).Skip(2).Take(3).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("Quantity: " + product.Quantity);
                    Console.WriteLine("Description: " + product.Description);
                    Console.WriteLine("Status: " + product.Status);
                    Console.WriteLine("Photo: " + product.Photo);
                    Console.WriteLine("Created: " + product.Created.ToString("dd/MM/yyyy"));
                    Console.WriteLine("Category Id: " + product.CategoryId);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 11
Name: Tivi 3
Price: 20
Quantity: 4
Description: Description 2
Status: False
Photo: photo3.gif
Created: 20/11/2022
Category Id: 1
---------------------
Id: 12
Name: Laptop 1
Price: 15
Quantity: 16
Description: Description 3
Status: True
Photo: photo4.gif
Created: 20/10/2021
Category Id: 2
---------------------
Id: 13
Name: Laptop 2
Price: 4
Quantity: 26
Description: Description 4
Status: False
Photo: photo5.gif
Created: 20/10/2022
Category Id: 2
---------------------

You can use combination of Skip method and Take method and Where method as below:

using EntityFrameworkCore_ConsoleApp.Models;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = (from product in databaseContext.Products
                                where product.Status == true 
                                select product).Skip(1).Take(2).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("Quantity: " + product.Quantity);
                    Console.WriteLine("Description: " + product.Description);
                    Console.WriteLine("Status: " + product.Status);
                    Console.WriteLine("Photo: " + product.Photo);
                    Console.WriteLine("Created: " + product.Created.ToString("dd/MM/yyyy"));
                    Console.WriteLine("Category Id: " + product.CategoryId);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 12
Name: Laptop 1
Price: 15
Quantity: 16
Description: Description 3
Status: True
Photo: photo4.gif
Created: 20/10/2021
Category Id: 2
---------------------
Id: 14
Name: Computer 1
Price: 17
Quantity: 34
Description: Description 5
Status: True
Photo: photo6.gif
Created: 20/12/2023
Category Id: 3
---------------------

You can use combination of Skip method and Take method and Where method and OrderBy method as below:

using EntityFrameworkCore_ConsoleApp.Models;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = (from product in databaseContext.Products
                                where product.Status == true 
                                orderby product.Price
                                select product).Skip(1).Take(2).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("Quantity: " + product.Quantity);
                    Console.WriteLine("Description: " + product.Description);
                    Console.WriteLine("Status: " + product.Status);
                    Console.WriteLine("Photo: " + product.Photo);
                    Console.WriteLine("Created: " + product.Created.ToString("dd/MM/yyyy"));
                    Console.WriteLine("Category Id: " + product.CategoryId);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 12
Name: Laptop 1
Price: 15
Quantity: 16
Description: Description 3
Status: True
Photo: photo4.gif
Created: 20/10/2021
Category Id: 2
---------------------
Id: 14
Name: Computer 1
Price: 17
Quantity: 34
Description: Description 5
Status: True
Photo: photo6.gif
Created: 20/12/2023
Category Id: 3
---------------------

You can use combination of Skip method and Take method and Where method and OrderBy method and Select method as below:

using EntityFrameworkCore_ConsoleApp.Models;

namespace EntityFrameworkCore_ConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (var databaseContext = new DatabaseContext())
            {
                var products = (from product in databaseContext.Products
                                where product.Status == true 
                                orderby product.Price
                                select new
                                {
                                    Id = product.Id,
                                    Name = product.Name,
                                    Price = product.Price
                                }).Skip(1).Take(2).ToList();
                products.ForEach(product =>
                {
                    Console.WriteLine("Id: " + product.Id);
                    Console.WriteLine("Name: " + product.Name);
                    Console.WriteLine("Price: " + product.Price);
                    Console.WriteLine("---------------------");
                });
            }
        }
    }
}
Id: 12
Name: Laptop 1
Price: 15
---------------------
Id: 14
Name: Computer 1
Price: 17
---------------------

The post Skip in LINQ Query in Entity Framework Core appeared first on OctopusCodes.

]]>