concept parameter in category entity framework

appears as: parameter, parameters, parameters, The parameters, parameter
Entity Framework Core in Action

This is an excerpt from Manning's book Entity Framework Core in Action.

The basic idea is that an EF Core’s LazyLoader instance will be provided via an entity class constructor with a parameter (see section B.2.2). As you can see in  listing B.1, the navigational property you want to lazy load must be set up as a backing field (see section 8.1). The property’s getter accesses the backing field via a call to the LazyLoader service, which ensures that the navigation property is loaded on a read.

EF Core 2.1 adds a new feature in which an entity class’s constructor can have parameters. Another EF Core 2.1 new feature, lazy loading, needs a method provided via the entity class’s constructor. In addition, having a constructor with parameters allows you to provide value properties and inject services into an entity being read in. Please see appendix B for more information.

Listing 8.4 Registering your static method representing your UDF using Fluent API
protected override void    #1  
    OnModelCreating(ModelBuilder modelBuilder)
{
    //… other configuration removed for clarity
    modelBuilder.HasDbFunction(    #2  
        () => MyUdfMethods.AverageVotes(default(int)))    #3  
        .HasSchema("dbo");    #4  
}

#1   Fluent API is placed inside the OnModelCreating method inside your application’s DbContext.
#2   HasDbFunction will register your static method as the way to access your UDF.
#3   Adds a call to your static method representation of your UDF code. The method isn’t called, but the lambda function is read to find out the name, return type, and parameters of the method.
#4   You can add options. Here you add HasSchema, as EF Core 2.0 had a problem of not setting the default schema property (fixed in 2.1). Other options, such as HasName, set the name of the UDF in the database.
Entity Framework 4 in Action

This is an excerpt from Manning's book Entity Framework 4 in Action.

If there is a case where you can’t use it, you can instantiate the ObjectContext class directly and pass the connection string name (more about connection strings in section 3.2.1). After that, you can use the CreateObjectSet<T> method, passing the entity set name as a parameter (more about this in chapter 4), to create the Object-Set<T> instance. You can see such code in the following snippet:

To execute an Entity SQL query through the ObjectContext class, you have to invoke its CreateQuery<T> method, passing the Entity SQL query as the parameter, and the return type as the generic parameter. Here’s an example of consuming such a method:

9.8.3. Using parameters to prevent injection

Lots of queries are parameterized through arguments. For instance, a query that looks for customers by their billing city accepts the customer’s city as an argument. In this type of query, we strongly recommend you to use parameters to avoid SQL injection attacks. You should never concatenate user input to create Entity SQL code. If you have already developed solutions using ADO.NET, you should be accustomed to parameters. If not, you’ll find them easy to use.