Table<TEntity>.InsertOnSubmit(TEntity) Yöntem

Tanım

Bir durumdaki pending insert varlığı bu Table<TEntity>öğesine ekler.

public:
 void InsertOnSubmit(TEntity entity);
public:
 virtual void InsertOnSubmit(TEntity entity);
public void InsertOnSubmit (TEntity entity);
member this.InsertOnSubmit : 'Entity -> unit
abstract member InsertOnSubmit : 'Entity -> unit
override this.InsertOnSubmit : 'Entity -> unit
Public Sub InsertOnSubmit (entity As TEntity)

Parametreler

entity
TEntity

Eklenecek varlık.

Uygulamalar

Örnekler

// Create a new Order object.
Order ord = new Order
{
    OrderID = 12000,
    ShipCity = "Seattle",
    OrderDate = DateTime.Now
    // …
};

// Add the new object to the Orders collection.
db.Orders.InsertOnSubmit(ord);

// Submit the change to the database.
try
{
    db.SubmitChanges();
}
catch (Exception e)
{
    Console.WriteLine(e);
    // Make some adjustments.
    // ...
    // Try again.
    db.SubmitChanges();
}
' Create a new Order object.
Dim ord As New Order With _
{.OrderID = 12000, _
 .ShipCity = "Seattle", _
 .OrderDate = DateTime.Now}

' Add the new object to the Orders collection.
db.Orders.InsertOnSubmit(ord)

' Submit the change to the database.
Try
    db.SubmitChanges()
Catch e As Exception
    Console.WriteLine(e)
    ' Make some adjustments.
    ' ...
    ' Try again.
    db.SubmitChanges()
End Try

Açıklamalar

Eklenen varlık, çağrılana kadar SubmitChanges bu tablodan gelen sorgu sonuçlarında görünmez.

Şunlara uygulanır