We would like to use csla 3.5 without the dling part. How do we that using ptracker project fetch
using (var ctx = ContextManager<ProjectTracker.DalLinq.PTrackerDataContext>.GetManager(ProjectTracker.DalLinq.Database.PTracker))
{
// get project data
var data = (from p in ctx.DataContext.Projects
where p.Id == criteria.Value
select p).Single();
LoadProperty<Guid>(IdProperty, data.Id);
LoadProperty<string>(NameProperty, data.Name);
LoadProperty<SmartDate, System.DateTime?>(StartedProperty, data.Started);
LoadProperty<SmartDate, System.DateTime?>(EndedProperty, data.Ended);
LoadProperty<string>(DescriptionProperty, data.Description);
mTimestamp = data.LastChanged.ToArray();
// get child data
LoadProperty<ProjectResources>(ResourcesProperty, ProjectResources.GetProjectResources(data.Assignments.ToArray()));
}
Is the following correct without using dling?
using (SqlConnection cn = new SqlConnection(Database.PTrackerConnection))
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getProject";
cm.Parameters.AddWithValue("@id", criteria.Id);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
LoadProperty<Guid>(IdProperty, dr.GetGuid("Id"));
LoadProperty<string>(NameProperty, dr.GetString("Name"));
LoadProperty<SmartDate, System.DateTime?>(StartedProperty, dr.GetSmartDate("Started", _started.EmptyIsMin));
LoadProperty<SmartDate, System.DateTime?>(EndedProperty, dr.GetSmartDate("Ended", _ended.EmptyIsMin));
LoadProperty<string>(DescriptionProperty, dr.GetString("Description"));
dr.GetBytes("LastChanged", 0, _timestamp, 0, 8);
// load child objects
dr.NextResult();
LoadProperty<ProjectResources>(ResourcesProperty,
ProjectResources.GetProjectResources(dr));
}
}
}
Thanks
Copyright (c) Marimer LLC