key.
Specifies the maximum length of an attribute.
Set Properties as required
Specify not to map CLR attributes to columns in the database
Map CLR attributes to specific columns in the database
Rename an undefined foreign key in the Model
Configure whether the string attribute supports Unicode content
Configure the Data Type of the database Column
Configure attributes of complex types
Configure the attribute as an optimistic concurrency token
Type ing
Specif
the " Onmodelcreating, query the SQL generated by the employee as follows:SELECT [extent1].[ Discriminator] As [discriminator], [extent1].[ EmployeeId] As [EmployeeId], [extent1].[ FirstName] As [FirstName], [extent1].[ LastName] As [LastName], [extent1].[ Salary] As [Salary], [extent1].[ Wage] as [wage] from [example8].[ Employee] as [Extent1] WHERE [extent1].[ Discriminator] In (n ' Fulltimeemployee ', n ' hourlyemployee ')In fact, the relationship between "
key.
Specifies the maximum length of an attribute.
Set Properties as required
Specify not to map CLR attributes to columns in the database
Map CLR attributes to specific columns in the database
Rename an undefined foreign key in the Model
Configure whether the string attribute supports Unicode content
Configure the Data Type of the database Column
Configure attributes of complex types
Configure the attribute as an optimistic concurrency token
Type ing
Specif
classes are derived from the person base class, as shown in.
In the database, this inheritance structure can have multiple forms. You can create a table named person, which contains all the information of instructors and students. It includes attributes they own (for example, teachers' hiredate and students' enrollmentdate) and their common attributes (for example, lastname and firstname ). Generally, you also need a discriminator to identify the type of the current row. (Here, the content of
modify it.Obviously, this implementation strategy adopted by Code first violates the relational database design paradigm, which is not easy for large projects to maintain data consistency.Another way to implement inheritance is tpt (table Pertype), regardless of the subclass parent class, one table per type.For example, there are three classes, instruct and student derive from person, and if you adopt a TPT
common, and the different times are saved separately in separate instructor and Student tables.
The schema for each entity class corresponding to a database table is called the Type Table TPT Inheritance (table per type). In the EF, TPH inheritance has better performance than TPT inheritance, because TPT inheritance requires complex connection queries. This t
There are several ways to map an inheritance relationship to a database table:First: TPH (table-per-hiaerachy) one table per level (only one table)Only a table with the name of a type named the parent class that contains all the property information for each subclass, using the Disciriminator column (usually the type name of the subclass), distinguishes which row represents what type of data.Second: TPT (table-per-type) Each type has a table (the pare
the header, that isNS. Common examples include:
NSLog
NSString
NSInteger
NSURL
NSImage
...
You will often see that some of the teaching will use:
Nslog (@ "% d", Myint );
This statement is mainly used in the console for tracking. You will see the value of Myint in the console (open the dbg window when running in xcode ). In other development environments, we may prefer to use MessageBox for debugging.
You can also see other classes with names, such as CF, CA, CG, and ui, such
Cfstringtokenizer
yourself.
Question 2: # What do import, @ interface, and so on?
1. # Import
You can think of it as # include. But it is best to use # import. Remember this.
2. @ interface and so on
For example, you can write a definition for the Child grabbing class in C:
Public class kids: System
{
Private string kidname = "mykid ";
Private string kidage = "15 ";
Private bool iscaughtkid ()
{
Return true;
}
}
Of course, the above statement is not necessarily
QueueDescriptionlinda is a teacher in ACM kindergarten. She is in charge of N kids. Because The dinning hall is a little bit far away from the classroom, those n kids has to walk in line to the dinning HAL L every day. When they is walking in line, if and only if the kids can see the other, they'll talk to each of the other. The
. @ interface and so on
For example, you can write a definition for the Child grabbing class in C:
Public class kids: System
{
Private string kidname = "mykid ";
Private string kidage = "15 ";
Private bool iscaughtkid ()
{
Return true;
}
}
Of course, the above statement is not necessarily correct. It is an example of a syntax.
In objective-C, you have to write the following:
First, write a kids. h file
POJ 3934 Queue
DescriptionLinda is a teacher in ACM kindergarten. she is in charge of n kids. because the dinning hall is a little bit far away from the classroom, those n kids have to walk in line to the dinning hall every day. when they are walking in line, if and only if two kids can see each other, they will talk to each other. two
examples include:NslogNsstringNsintegerNsurlNsimage...
You will often see that some of the teaching will use:Nslog (@ "% d", Myint );
This statement is mainly used in the console for tracking. You will see the value of Myint in the console (open the dbg window when running in xcode ). In other development environments, we may prefer to use MessageBox for debugging.
You can also see other classes with names, such as CF, CA, CG, and ui, suchCfstringtokenizerCalayer, which indicates the layer of c
In JavaScript, object and array are passed by reference.
Sometimes you may come into trouble if you don't keep this in mind, especial inRecursion.
Let's see an example:
First, prepare a JavaScript array to present a tree data:
VaR treedata = [{"name": "root1", "kids": [{"name": "leaf1" },{ "name": "leaf2"}]}, {"name": "root2"}];
The expected HTML structure is:
Our JavaScript code:
Function resolvetree (rootnode,
object level (especially when autodetectchanges is disabled to improve dbcontext find () performance), available caches include query plan caching and metadata caching) and result cache (results caching ). EF still does not provide secondary cache, but we can refer to some guidelines for implementation-such as examples on codeplex and Julia Lerman'sArticle"Entity Framework and level 2 cache in Windows azure ";
Optional no trace query (no State tracing overhead ). Currently, this option is on
of a class, including inherited, are mapped to columns in the corresponding table, which is known as a table (Table-per-concrete Class) inheritance for each specific class. If you implement TPC inheritance for the Person,student and instructor classes, then the student and instructor tables will be no different from the previous one.The TPC and TPH inheritance patterns in the Entity Framework are generally better than the TPT inheritance pattern beca
above, you can also see other classes with names, such as CF, CA, CG, and UI:For example:CFStringTokenizer is used for word segmentation.CALayer, which indicates the layer of Core AnimationCGPoint indicates a vertex.UIImage indicates the image in the iPhone.Break down the abbreviations:CF refers to Core Foundation, CA refers to Core Animation, CG refers to Core Graphics, and UI refers to Iphone UUser Interface .......Next, let's take a look at # import, @ interface,Of course, for example, # imp
.
Table per type
Clearly align with table
You need to use a single query to find all sub-object objects.
Different from TPH, you can set the table constraint for each type of variance.
It is easy to change or adjust each type of data.
When you want to obtain data from a single instance, You need to perform multiple join operations.
The number of tables increases rapidly with the number of different types.
()) { context.Lodgings.Add(lodging); context.Lodgings.Add(resort); context.SaveChanges(); }
We can see that EF uses discriminator to distinguish lodging from resort.Use fluent API to customize TPH delimiter Fields
If you think that the default discriminator column name is not intuitive enough, you can use the fluent API to configure the type and name of the discriminator column (Data annotations are not marked and can be used to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.