考虑实体框架模型:
public class Location
{
public bool IsCustomer { get; set; }
public bool IsSupplier { get; set; }
}
public class Customer : Location {}
public class Supplier : Location {}
在这种情况下,我希望将Customer
作为别名。每当我收到DbSet<Customer>
时,它都会返回Location
的所有IsCustomer == true
。
这可能吗?谢谢!
答案 0 :(得分:0)
签出以下代码以使用指令而不是使用类名本身:
shared_data xcc_z::gzip(data_ref s)
{
z_stream stream;
stream.zalloc = NULL;
stream.zfree = NULL;
stream.opaque = NULL;
if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 16 + MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY))
{
assert(false);
return {};
}
shared_data d(deflateBound(&stream, s.size()) + 8);
stream.next_in = const_cast<unsigned char*>(s.data());
stream.avail_in = s.size();
stream.next_out = d.data();
stream.avail_out = d.size() - 8;
deflate(&stream, Z_FINISH);
deflateEnd(&stream);
unsigned char* w = stream.next_out;
w = write_int_le(4, w, crc32(crc32(0, NULL, 0), s.data(), s.size()));
w = write_int_le(4, w, s.size());
return d.substr(0, w - d.data());
}