Ejemplo n.º 1
0
        public IEnumerable <IAssemblyData> Dequeue(int batchSize)
        {
            string text = string.Format("SELECT TOP {0} * FROM T_FEED_QUEUE WHERE F_DATE_STARTED IS NULL ORDER BY F_DATE_CREATED", batchSize);

            SqlCommand cmd = Db.GetCommand(text, CommandType.Text);

            List <AssemblyData> list = new List <AssemblyData>();

            Db.ExecuteDataReader(cmd, dr =>
            {
                while (dr.Read())
                {
                    list.Add(new AssemblyData()
                    {
                        Assembly = AssemblySerializer.GetAssemblyFromByteArray(dr["F_ASSEMBLY"]),
                        MethodParametersTypes = GetCastedByteArray <Type[]>(dr["F_METHOD_PARAM_TYPES"]),
                        ConstructorParameters = GetCastedXml <object[]>(dr["F_CONSTRUCTOR_PARAMETERS"]),
                        MethodParameters      = GetCastedXml <object[]>(dr["F_METHOD_PARAMETERS"]),
                        FullyQualifiedName    = Conversions.GetString(dr["F_FULLY_QUALIFIED_CLASS_NAME"]),
                        Id                  = Conversions.GetCastValue <Guid>(dr["F_GUID"]),
                        MethodToRun         = Conversions.GetString(dr["F_METHOD_NAME"]),
                        TimeoutMilliseconds = Conversions.GetCastValue <int>(dr["F_TIMEOUT_MILLISECONDS"])
                    });
                }
            });

            return(list);
        }
Ejemplo n.º 2
0
 private static T GetCastedByteArray <T>(object v)
 {
     byte[] arr = Conversions.GetCastValue <byte[]>(v);
     return(Serializer.Deserialize <T>(arr));
 }
Ejemplo n.º 3
0
        private static T GetCastedXml <T>(object v)
        {
            string xml = Conversions.GetCastValue <string>(v);

            return(Serializer.XmlDeserialize <T>(xml));
        }
Ejemplo n.º 4
0
 public static Assembly GetAssemblyFromByteArray(object v)
 {
     byte[] arr = Conversions.GetCastValue <byte[]>(v);
     return(Assembly.Load(arr));
 }