This error occurs when exporting views/triggers/procedures from one database or server to another as the user that created that object no longer exists.
So here are the solutions:
Change DEFINERCreate the missing user
Create the missing user
or simply run following query
grant all on *.* to ‘root’@’%’ identified by ‘password’ with grant option;
There are two properties of Morris.Js bar we can use to achieve this
1) barGap
2) barSizeRatio
barGap is an integer that sets the space between bars in a single bar group.
Default is 3.
Increase this value to space them further, decrease it to bring them closer.
barSizeRatio is the proportion of the width of the entire graph given to bars. Defaults to 0.75.
Increase the number closer to 1 to make the bars wider, if its =1 the bars will take up the entire graph, if its > 1 bars will overlap.
This kind of error occurred When DataAccess tries to update the row in the database which has the original values for the fields that have changed.
The reason the update fails is that the artificial columns added at runtime are nullable but the CLR property which these columns are mapped to are all non-nullable. Ex – bit column is mapped to Boolean CLR property.
The generated UPDATE statement tries to find a row with the CLR default value i.e 0 but the value in the column is NULL.
I have updated the method that maps the artificial properties as follows –
var propType = Type.GetType(property.PropertyType);
if(propType.IsValueType)
{
propType = GetNullableType(propType);
}
var primitivePropertyConfiguration = myConfig.HasArtificialPrimitiveProperty(property.PropertyName,propType).HasFieldName(property.PropertyName);
Here I check if the Type of the field is a value type and if it is, then I create a nullable CLR type instead of the non-nullable type.
The helper method used is as below
public static Type GetNullableType(Type type)
{
if (type.IsValueType)
{
Type nullable = typeof(Nullable);
return nullable.MakeGenericType(new[] { type });
}
return type;
}
The ForeignKey attribute is used to configure a foreign key in the relationship between two entities in EF 6 and EF Core. It overrides the default conventions. As per the default convention, EF makes a property as foreign key property when its name matches with the primary key property of a related entity.
ForeignKey Signature: [ForeignKey(name string)]
name: Name of the associated navigation property or the name of the associated foreign key(s).
Consider the following example of one-to-many relationship among entities.
The above example depicts a one-to-many relationship between Student and Standard entities. To represent this relationship, the Student class includes a property StandardId with reference property Standard and Standard entity class includes collection navigation property Students. A property name StandardId in Student entity matches with the primary key property of Standard entity, so StandardIdin Student entity will automatically become a foreign key property and corresponding column in the db table will also be a foreign key column as shown below.
The [ForeignKey] attribute overrides the default convention for a foreign key It allows us to specify the foreign key property in the dependent entity whose name does not match with the primary key property of the principal entity.
The [ForeignKey(name)] attribute can be applied in three ways:
[ForeignKey(NavigationPropertyName)] on the foreign key scalar property in the dependent entity
[ForeignKey(ForeignKeyPropertyName)] on the related reference navigation property in the dependent entity
[ForeignKey(ForeignKeyPropertyName)] on the navigation property in the principal entity
[ForeignKey] on the foreign key property in the dependent entity:
The [ForeignKey] on the foreign key property in the dependent entity and the related navigation property name can be specified as a parameter as shown below.
In the above example, the [ForeignKey] attribute is applied on the StandardRefId and specified the name of the navigation property Standard. This will create the foreign key column named StandardRefId in the Students table, preventing the generation of a StandardId column in the database.
[ForeignKey] on the navigation property in the dependent entity:
The [ForeignKey] attribute can be applied to the navigation property and the related foreign key property name can be specified as shown below.
In the above example, the [ForeignKey] attribute is applied on the Standard navigation property and specified the name of the foreign key property StandardRefId. This will create the foreign key column named StandardRefId in the Students table, preventing the generation of a StandardId column in the database.
[ForeignKey] on the navigation property in the principal entity:
The [ForeignKey] attribute can be applied to the navigation property in the principal entity and the related foreign key property name can be specified in the dependent entity as shown below.
In the above example, the [ForeignKey] attribute is applied on the Students navigation property in the principal entity Standard. This will create a foreign key column StandardRefId in the Students table in the database.
When you have separate class library projects for Data access layer which contains your entity model and when you are giving reference of this class library to your web application on build you may get following error
Could not load type System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider
You can solve this error by following line assembly reference in your website project webconfig file