/// <summary> /// Deprecated Method for adding a new object to the Sources EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSources(Source source) { base.AddObject("Sources", source); }
/// <summary> /// Create a new Source object. /// </summary> /// <param name="sourceId">Initial value of the SourceId property.</param> /// <param name="sourceTypeId">Initial value of the SourceTypeId property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param> public static Source CreateSource(global::System.Int32 sourceId, global::System.Int32 sourceTypeId, global::System.String name, global::System.DateTime createdDate, global::System.DateTime modifiedDate) { Source source = new Source(); source.SourceId = sourceId; source.SourceTypeId = sourceTypeId; source.Name = name; source.CreatedDate = createdDate; source.ModifiedDate = modifiedDate; return source; }
public SourceData Insert(SourceData data) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var source = new Source(); DataMapper.Map(data, source); ctx.ObjectContext.AddToSources(source); ctx.ObjectContext.SaveChanges(); data.SourceId = source.SourceId; return data; } }
private void Fetch(Source source, SourceData sourceData) { DataMapper.Map(source, sourceData); }
public SourceData Update(SourceData data) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var source = new Source { SourceId = data.SourceId, SourceTypeId = data.SourceTypeId }; ctx.ObjectContext.Sources.Attach(source); DataMapper.Map(data, source); ctx.ObjectContext.SaveChanges(); return data; } }
internal static void Map(SourceData source, Source destination) { destination.SourceId = source.SourceId; destination.SourceTypeId = source.SourceTypeId; destination.Name = source.Name; destination.CreatedDate = source.CreatedDate; destination.ModifiedDate = source.ModifiedDate; }